How abdoadel123/compiler works
Project Type Analysis
This is a compiler project implemented in Java, consisting of two distinct phases:
• Phase 1: Appears to be focused on lexical analysis (tokenization)
• Phase 2: Appears to be focused on parsing and syntax analysis
Main Components
A. Compiler Phase-1 Components:
• Tokenizer/Lexical Analyzer (represented by Token.java)
• Pattern Matcher (represented by Matched.java)
• Main Compiler Controller (Compiler.java)
B. Compiler Phase-2 Components:
• Abstract Syntax Tree (AST) components:
• Node-based structure (Node.java as base)
• Various node types (Expression.java, Statement.java, etc.)
• Parser components:
• Class declarations
• Method declarations
• Variable declarations
• Type system components
• Symbol table handlers
[Phase 1: Lexical Analysis]
• Input Stream
• Tokenizer
• Token Stream
• ▼
[Phase 2: Syntax Analysis]
• Parser
• AST Builder
• Symbol Table
Specific Elements
A. Phase 1 Section:
• Input file handler (input.txt)
• Token generator
• Pattern matcher
• Output generator (output.txt)
B. Phase 2 Section:
• Parser components:
• Class structure parser
• Method parser
• Expression parser
• AST node hierarchy
• Symbol table manager
• Multiple output handlers (output1.txt through output8.txt)
Important Relationships to Highlight
• Pipeline flow from input through Phase 1 to Phase 2
• Hierarchical relationship between different AST nodes
• Demonstrate the interaction between the parser and symbol table
• How the various declaration handlers (Class, Method, Variable) interact