Welcome to the Siyo Compiler Project! This project aims to develop a compiler for the Siyo language.
The Siyo Compiler Project is designed to provide a comprehensive compiler implementation for the Siyo programming language. It encompasses various components, including lexical analysis, parsing, syntax tree generation, semantic analysis, code generation, and more.
- Lexical analysis: The
Lexer
class performs lexical analysis on Siyo source code, generating tokens representing the language's lexical elements. - Parsing: The
Parser
class parses the Siyo source code and generates a syntax tree representation of the program's structure. - Syntax tree: The
SyntaxTree
,SyntaxNode
, and related classes provide a hierarchical representation of the Siyo program's syntax. - Semantic analysis: The compiler performs semantic analysis on the syntax tree to enforce language-specific rules and detect potential errors.
- Code generation: The compiler generates executable code or intermediate representation (e.g., bytecode) from the syntax tree.
- Diagnostics: The compiler reports diagnostics such as parsing errors, lexical errors, and semantic errors.
The project will have following components:
com.urunsiyabend.codeanalysis
: Contains classes for code analysis, including the lexer, parser, syntax tree, syntax nodes, and token types.com.urunsiyabend.codeanalysis.binding
: Contains classes for binding expressions in the code analysis process.com.urunsiyabend.codeanalysis.syntax
: Contains classes for syntax analysis in the code analysis process.
com.urunsiyabend.codegeneration (soon!)
: Contains classes for code generation, including code emitter and bytecode generation (if applicable).com.urunsiyabend.semanticanalysis (soon!)
: Contains classes for semantic analysis, including type checking, symbol table management, and error reporting.com.urunsiyabend.util (soon!)
: Contains utility classes used throughout the project.
To use the Siyo Compiler, follow these steps:
- Create a new instance of
Lexer
and pass the Siyo source code as input. - Use the
getNextToken()
method ofLexer
to retrieve tokens from the input source code. - Pass the tokens to an instance of
Parser
to generate the syntax tree. - Perform semantic analysis on the syntax tree using the appropriate classes and algorithms.
- Generate executable code or intermediate representation using the code generation component.
- Execute or further process the generated code.
Refer to the individual classes and their documentation for more detailed usage instructions.