A compiler is an essential tool in software development, acting as a translator for high-level source code into machine-readable instructions. This project focuses on implementing a compiler for a For-loop statement, covering crucial phases of compilation.
In this phase, the source code is transformed into a set of tokens, including reserved words, special symbols, numbers, identifiers, and comments.
To progress to subsequent phases, a well-designed CFG is crucial. The CFG must be tailored to the specific structure of the given statement.
This phase emphasizes the code's structure, constructing an abstract syntax tree.
Checking the code's meaning and context to ensure alignment with the language's semantics. These initial phases enable the compiler to comprehend the code's structure and meaning.
- High-level language
- Lexical Analyzer (Tokenizer)
- Syntax Analyzer (CFG, Parser)
- Semantic Analyzer -> Semantic Tree
This project requires a Parse Tree parser, providing a geometrical representation of the derived string.
The specific statement implemented in this project is the For-loop statement.
For (int X = 0; X <= 100; X++)
{
Sum += X;
}
The Simplified Instructional Computer (SIC) machine is a hypothetical computer architecture introduced by Leland Beck. It's a simplified model used for educational purposes. The SIC machine includes various instructions and features to demonstrate fundamental concepts of computer organization and programming.
- Display inputs and outputs for each phase.
- Print the designed CFG used by the parser.
- Provide a brief project report, including:
- Simple pseudo-code or flowchart of the design.
- Screenshots of mentioned inputs and outputs.