Getting Started
Creating new Sigil projects with sigil init.Creating a New Project
Use sigil init to create a new project:
sigil init my-projectThis creates a new directory my-project/ with a basic project structure.
Project Templates
Sigil provides several templates for different project types:
sigil init my-app # Application with entry point (default template)
sigil init my-lib --template library # Reusable library with exports
sigil init my-cli --template cli # Command-line tool with argument parsing
sigil init my-game --template game # Game project with graphics/audio setupTemplate: default
Creates a simple application:
my-app/
├── package.sgl # Package definition
├── README.md # Project documentation
└── src/
└── my-app/
└── main.sgl # Entry point moduleTemplate: library
Creates a library package:
my-lib/
├── package.sgl
├── README.md
├── src/
│ └── my-lib.sgl # Main library module
└── test/
└── test-my-lib.sglTemplate: cli
Creates a CLI application with argument parsing:
my-cli/
├── package.sgl
├── README.md
└── src/
└── my-cli/
└── main.sgl # CLI with sigil/argsPackage File Format
The package.sgl file defines your project:
(package
name: "my-app"
version: "0.1.0"
description: "My application"
license: "MIT"
;; Entry point for executable apps
;; The module must export a 'main' procedure
entry: '(my-app main)
;; Dependencies from the Sigil ecosystem
dependencies: (list
(from-workspace name: "sigil-stdlib")))Entry Point
The entry: field specifies which module to run when the application starts:
- Format:
'(module-name)- a quoted list of symbols representing the module - The module must export a
mainprocedure that takes no arguments - Example:
entry: '(my-app main)runs themainprocedure from(my-app main)module
Module Naming Convention
Module names follow the directory structure under src/:
| File Path | Module Name |
|---|---|
src/my-app/main.sgl | (my-app main) |
src/my-app.sgl | (my-app) |
src/my-app/utils.sgl | (my-app utils) |
Running Your Project
After creating a project:
cd my-project
sigil run # Build and run the app
sigil test # Run tests (if any)The sigil run command automatically builds any out-of-date modules before running.
For a release build (standalone executable):
sigil build --config release # Create release build
./build/release/bin/my-project # Run the release buildExample: Hello World Application
sigil init hello-world
cd hello-worldEdit src/hello-world/main.sgl:
(define-library (hello-world main)
(export main)
(begin
(define (main)
(println "Hello, World!"))))Build and run:
sigil run
# Output: Hello, World!