Skip to content
/ elmc Public

A compiler for the Elm language written in ANSI C99.

Notifications You must be signed in to change notification settings

niho/elmc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A compiler for the Elm language written in ANSI C99.

Usage

The compiler is intended to be used either as a standalone compiler and virtual machine for executing Elm code, or embedded as a static or dynamic library in a larger program.

Features

The compiler is currently targeting Elm 0.19, but is not yet feature complete.

Language features

The following core language features have been implemented so far:

  • Single line comments
  • Multiline comments
  • Boolean literals
  • Int and Float literals
  • String and Char literals
  • Multiline string literals
  • Expressions
  • Indentation sensitive parsing
  • Infix operators
  • Lists
  • Tuples
  • Records
  • If-then-else conditionals
  • Case-of conditionals
  • Pattern matching
  • Function declarations
  • Anonymous functions
  • Structural typing (function arguments)
  • Function application
  • Higher-order functions
  • Arithmethic operators with type inference
  • Let expressions
  • Modules
  • Qualified imports
  • Type annotations
  • Type aliases
  • Custom types
  • Ports
  • Effect managers

Kernel

The kernel contains native implementations of some core functions used by packages in the elm namespace (e.g. elm/core and friends). These packages typically contain native code written in Javascript. The elmc compiler instead provides versions of these functions written in C or Assembler.

Optimizations

When compiling Elm code the compiler will generate an Intermediate Representation (IR) of the source code. This IR is then analysed and optimized before being passed to the code generator step. The following optimizations are currently implemented:

Just-in-Time (JIT) compiler

After the optimization step the IR is transformed to executable machine code by the JIT compiler.

About

A compiler for the Elm language written in ANSI C99.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published