Skip to content

A compiler in Racket for a subset of C/C++. Applied language recognition theories.

Notifications You must be signed in to change notification settings

jathu5/compiler

Repository files navigation

Gmail Outlook LinkedIn GitHub


project-thumbnail

Compiler

skill-thumbnail skill-thumbnail skill-thumbnail

A compiler in Racket for a subset of C/C++. Applied language recognition theories.

Getting Started

Instructions

  • Run compiler
racket compiler.rkt [action] [int] [int] < [input]

where action is one of scan, parse, analyze, assembly, binary and input is code file

  • Run test suite
chmod u+x compile_suite.sh
./compile_suite.sh [input]

where input is test file

Code File Template

[optional procedure(s) with body format like main]

int main(int [id name], int [id name]) {
   [optional int declaration or int* declaration set to NULL]
   [optional statements (e.g. arithmetic, if, while)]
   return [int expression];
}

Test File Template

Each line must have the following 5, in order:
   1) Path to input file
   2) Compilation action (e.g. scan, parse, analyze, assembly, binary) or . which defaults to assembly
   3) First int of main function or . which defaults to 0
   4) Second int of main function or . which defaults to 0
   5) Path to output file or . which defaults to terminal stdout/stderr

Newline at the end

Contributors Stargazers

back to top