How pipluppp/interpreter works
Main Components Identification
The system should be represented as a multi-stage compiler pipeline with these key components:
a. Scanner (Lexical Analyzer)
• Input: Source code (.core files)
• Output: Symbol table (symbol_table.txt)
• Key files: scanner.c, token.h
b. Parser (Syntax Analyzer)
• Input: Symbol table
• Output: Parse tree (parse_tree_output.ebnf)
• Key files: parser.c
Input Files (.core) → Scanner → Symbol Table → Parser → Parse Tree
Grammar Files
• grammar.ebnf
• implemented_grammar.ebnf
• grammar_derivations/
Detailed Component Breakdown
Scanner Component:
[Source Files] → [Scanner]
• ↓
• Token recognition
• Error handling
• Comment filtering
• Line/Column tracking
• ↓
• [Symbol Table]
Parser Component:
[Symbol Table] → [Parser]
• ↓
• Recursive Descent Parsing
• Grammar rule validation
• Error recovery
• Parse tree generation
• ↓
• [Parse Tree]
Testing Framework Integration
Test components as a parallel structure:
[Test Files]
• ↓
test_lexer/
test_parser/
• ↓
[Test Results]
Important Notes
• Grammar files as a reference database
• One-token-at-a-time processing flow
• Recursive descent parsing strategy
• Error handling paths
• File format specifications (.core, .ebnf, .txt)
Implementation Notes
• Single-pass nature of the scanner
• Token stream processing
• Grammar-driven parsing
• Error handling and recovery mechanisms
• Test integration points