Skip to content

assignment 1 of ucas course <<advanced compiler>>, a AST-interpreter based on clang.

Notifications You must be signed in to change notification settings

enochii/AST-Interpreter

Repository files navigation

Compiler Homework

Assignment 1, a tiny ast interpreter for a subset of C.

Build the project

mkdir build
cd build
cmake –DLLVM_DIR=your-llvm-dir -DCMAKE_BUILD_TYPE=Debug ../.
# as an example: cmake –DLLVM_DIR=/usr/local/llvm10d -DClang_DIR=/usr/local/llvm10d/lib/cmake/clang  -DCMAKE_BUILD_TYPE=Debug ../.
make
//ast-interpreter will be built in dir your-project-dir/build/bin

Visualize the AST via clang:

clang -Xclang -ast-dump -fsyntax-only

Run our tiny interpreter:

./ast-interpreter "`cat ../test/test01.c`"

Test & grading

I write a simple script to grade the interpreter implementation. It compares the output of ast-interpreter with gcc. The official grading script(grade-official.sh) is also provided, which is modified from grade.sh. Run by:

source grade.sh # or grade-official.sh

More information

You can take a look at the note.md if you are interested in implementation details.

About

assignment 1 of ucas course <<advanced compiler>>, a AST-interpreter based on clang.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published