Skip to content

A work-in-progress compiler for the Civic model programming language, written in Haskell.

License

Notifications You must be signed in to change notification settings

svkampen/haskompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haskompiler

This is a (work-in-progress) compiler for the Civic model programming language.

I'm writing it as an exercise to deepen my Haskell knowledge, and to show that higher-level languages such as Haskell can be just as or more suited to a course on compiler construction than C, the language that was used in the compiler construction course I followed (that Civic was created for).

Currently, the project is still in early stages. The lexer and parser are mostly finished (some constructs are not yet implemented, but could be added without too much effort), but the traversals are still very sparse as I'm still designing and evaluating the traversal framework (as of now, just parts of the semantic analysis component work).

Documentation is also still very sparse — I'm working on improving it.

Components

The compiler is currently structured into three main components: an Alex-based lexer (lexer/Tokens.x), a Megaparsec-based parser (src/Parser/), and a set of AST traversals (src/Traversal.hs for common traversal code, src/Traversals/ for the individual traversals).

Building and running

Setup.hs will automatically generate the lexer, but it requires alex to be on your executable path. Aside from that dependency, everything should be resolved automatically when building via Stack.

To build the compiler, simply run stack build anywhere in the project tree.

About

A work-in-progress compiler for the Civic model programming language, written in Haskell.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published