Skip to content
/ imp Public

Compiler for IMP programming language implemented in Haskell

License

Notifications You must be signed in to change notification settings

eugmes/imp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMP Compiler Implemented in Haskell

Build Status

This is an implementation of IMP compiler in Haskell programming language. It uses LLVM as compiler backend. Megaparsec is used for parsing.

The programming language is specified in this document http://gcmuganda.faculty.noctrl.edu/classes/Spring12/306/Imp.pdf.

This work is inspired by Hakell LLVM Tutorial by Stephen Diehl.

Building

It is recommended to use stack to build the program:

% stack build

After this IMP programs can be compiled by running:

% stack exec -- impc test/examples/hello.imp
% ./hello
Hello World!

This runs cc. To specify a different compiler, use --cc command line option or CC environment variable.

Extensions

The language has several extensions compared to the original specification. All of the extensions are taken from Ada:

  • String literals can have embedded quotation marks by repeating them twice.

  • If expressions can have additional elsif parts.

  • Function and procedure arguments can have in, out, and in out modes.

About

Compiler for IMP programming language implemented in Haskell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published