Skip to content

civp/tiger-compiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLVM Based Tiger Language Compiler

The Tiger language is a simple and compact imperative programming language, with integers (Integer) and string (String) variables, arrays (Array), records (Record), and nestable functions (Function). The language has no concept of statements, and the program consists of expressions.

Tiger is defined by Andrew Appel in the famous "Tiger Book"-"Modern Compiler Implementation in Java 1". For specific specifications, see "Tiger Language Reference Manual" by Prof. Stephen Edwards.

This course project aims to implement a simple Tiger language compiler. At the same time complete the visualization of the abstract syntax tree.

Environment

  • flex 2.6.4
  • bison 3.0.4
  • llvm 6.0.0
  • g++ 7.5.0

Build and test

To build the compiler:

cd src
make

To test the compiler:

./parser < [path_to_test_program]

e.g.

./parser < ../test/test1.tig

An alternative way to test the program on queens.tig (the program of the Eight Queens Problem):

make test

If only the AST is needed:

./parser -v < [path_to_test_program]

If only the IR is needed:

./parser -i < [path_to_test_program]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 84.5%
  • Yacc 8.1%
  • Lex 6.5%
  • Makefile 0.9%