Skip to content

schurhammer/gig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gig

Gig is a gleam compiler written in gleam.

How to use

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.

Feature / Todo List

Basics

  • 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

  • Functions
  • Higher order functions
  • Anonymous functions
  • Function captures
  • Generic functions
  • Pipelines
  • Labelled arguments
  • Documentation comments
  • Deprecations

Flow control

  • 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

Other Data types

  • Tuples
  • Custom types
  • Records
  • Record accessors
  • Record updates
  • Generic custom types
  • Results
  • Bit arrays

Standard library

There is limited support for standard library functions, see stdlib/.

Advanced features

  • Opaque types
  • Use
  • Todo
  • Panic
  • Let assert
  • Externals

Contributing

I am not accepting code contributions at this time. Feel free to make issues, suggestions, or discussions though.

Releases

No releases published

Packages

No packages published