Skip to content

Toy compiler from a simple language to LLVM-IR implemented from scratch in Haskell

License

Notifications You must be signed in to change notification settings

Koukyosyumei/MyCompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyCompilier

This project implements a compiler that translates code from a simple language into LLVM IR. This project is inspiered by Kaleidoscope.

What it does:

  • Takes source code as input and breaks it down into its building blocks (identifiers, numbers, expressions) using a lexer and parser.
  • Generates LLVM IR that represents the functionality of the source code. This code can then be compiled and run by an LLVM toolchain.

What it can do:

  • Handles basic expressions involving arithmetic operations (addition, multiplication, comparison).
  • Supports function definitions with arguments and function calls.
  • Generates code for conditional statements (if statements)

Examples

./main "def main() if 4<3 then 12 else 13;" | lli; echo $?

About

Toy compiler from a simple language to LLVM-IR implemented from scratch in Haskell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published