How crocobob911/lexicalanalyzer_assignment1_plt works
Main Components
a) Lexical Analysis Pipeline:
• Input Handler (Reading code1.txt file)
• Tokenizer/Scanner
• Symbol Table Manager
• Error Handler
b) Parser Components:
• LL(1) Parser
• Grammar Rules Manager
• Semantic Analyzer
• Expression Evaluator
Component Relationships
Input File → Lexical Analyzer → Parser → Expression Evaluator → Output
Specific Design Elements
a) Input Processing Layer:
• File input component (code1.txt)
• Line-by-line processing component (mentioned as missing in README)
• Error handling mechanism
b) Lexical Analysis Layer:
• Token Generator
• Counter Components for ID, Const, and OP
• Dictionary-based token storage
c) Parser Layer:
• Grammar Rules Engine
• Epsilon/Lambda handling component
• Parse Tree Builder
d) Execution Layer:
• Variable Storage (for a, b, c)
• Expression Evaluator
• Result Calculator
Important Details to Highlight
• Error handling paths (showing how errors are collected in errorList)
• Token counting mechanism
• Line-by-line processing flow
• Variable evaluation pipeline
Specific Implementation Notes
Special considerations:
• Epsilon/Lambda production handling
• Error collection and reporting mechanism
• Token counting system
• Variable state tracking