Gig is a gleam compiler written in gleam.
git clone https://github.com/schurhammer/gig
cd gig
gleam run -m gig samples/hello_world.gleam
./samples/hello_world
This will compile the file samples/hello_world.gleam
to samples/hello_world.c
and then use a c compiler to create a binary at samples/hello_world
.
Optional flags:
--release
: enable optimisation--gc
: enable garbage collection--compiler=name
: the name/path of the c compiler
Dependencies:
- clang/gcc/tcc is needed to compile to binary (clang seems to work best for gc)
- Boehm GC library needs to be available for --gc
You may wish to increase your stack size ulimit -s unlimited
to avoid stack overflows.
- Bools
- Ints
- Floats
- Number formats (other than decimal)
- Strings
- Lists
- Equality
- Assignments
- Discard patterns
- Type inference
- Type annotations
- Modules (note: modules are resolved relative to the root file)
- Dependencies
- Unqualified imports
- Type aliases
- Blocks
- Constants
- Memory Management (GC/RC)
- Functions
- Higher order functions
- Anonymous functions
- Function captures
- Generic functions
- Pipelines
- Labelled arguments
- Documentation comments
- Deprecations
- Case expressions
- Variable patterns
- Constructor patterns
- String patterns
- List patterns
- Recursion
- Tail calls (note: the c compiler may do this for us)
- Multiple subjects
- Alternative patterns
- Pattern aliases
- Guards
- Exhaustiveness checking
- Tuples
- Custom types
- Records
- Record accessors
- Record updates
- Generic custom types
- Results
- Bit arrays
There is limited support for standard library functions, see stdlib/
.
- Opaque types
- Use
- Todo
- Panic
- Let assert
- Externals
I am not accepting code contributions at this time. Feel free to make issues, suggestions, or discussions though.