Skip to content

RazNayr/Compiler-Theory-And-Practice

Repository files navigation

Project Artefacts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Source Code - Java Programming Language
-----------------------------------------------------------------
src/Main.java
Main class repsonsible for using the hand-crafted lexer and parser for
SmallLangV2 and uses the three visitors to traverse the generated AST.

src/MainANTLR.java
Main class repsonsible for using the compiler-compiler generated lexer 
and parser for producing a parse tree. The parse tree is then converted
to an AST and this is used by the three visitor passes to output information.

src/Lexer/*.java
All classes responsible for building the DFA and defining the hand-crafted lexer.

src/Parser/Parser.java
Parser class responsible for parsing most expressions and statements within the SmallLangV2 language.

src/Parser/AST/*
AST class nodes representing specific EBNF rules.

src/Parser/EnumTypes/*.java
Java enumerators for defining different types.

src/SymbolTable/*.java
All classes responsible for representing the symbol table for use with the semantic visitor and interpreter visitor.

src/Visitors/*.java
Includes the Visitor interface along with all hand-crafted visitors implementing such visitor for AstToXml conversion, semantic analysis and interpreter execution. The two other visitors are used to convert the parse tree generated from ANTLR to its AST equivalent. These implement a different interface.

src/ANTLR/*
All artefacts generated by the ANTLR tool after building the SmallLang.g4 grammar.

src/ANTLRV2/*
All artefacts generated by the ANTLR tool after building the SmallLangV2.g4 grammar.

src/Grammars
Consists of the two ANTLR grammars SmallLang.g4 and SmallLangV2.g4 which store both lexer and parser rules for generating the parse tree of an input program
-----------------------------------------------------------------


Data Folders
-----------------------------------------------------------------
src
Folder used to store all source of the above described source code.

SmallLangV2Programs
Folder containing valid SmallLang input programs to be tested by the program. 
-----------------------------------------------------------------




About

Implementation of a Java compiler for a small programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors