Skip to content

krishnadwypayan/decaff-compiler-krishnadwypayan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 

Repository files navigation

decaff-compiler-krishnadwypayan

Code Structure

The entire code is inside src folder. Header files have been added in the src/Headers folder. The corresponding cpp files are inside the src folder.

  • src/lexer.l is the scanner file that scans all the decaf source code and geenrates tokens.
  • src/parser.ypp is the flex parser that will handle all the tokens generated by the scanner.
  • src/Headers/astNode.h defines the class structure for the AST representation of the decaf source program.
  • src/Headers/program.h defines the class that creates objects for the main fieldDeclarations class and methodDeclarations class defined under the terminal Program.
  • src/Headers/fieldDeclarations.h defines the classes that handle the field declarations of the Program. It also includes the variables defined in the field declarations section.
  • src/Headers/methodDeclarations.h defines the classes that handle the all method declarations and method arguments of the decaf program.
  • src/Headers/block.h handles the variable declarations inside a block, along with the definitions of a block, statements and expressions.
  • src/Headers/statements.h handles the various types of statements.
  • src/Headers/llvm_context.h defines the basic structures to be used for the LLVM IR code generation part. -src/.*cpp files are the corresponding cpp files for each of the header files that define the methods of each of the classes declared in their respective header files.

Run

cd src
make

After the successful compilation, run the files as :

./parser ../test/<filename>.dcf

Further implementation

The current code completely parses the test decaf programs. Code generation part is yet to be completed.

Releases

No releases published

Packages

No packages published