This project involves the development of a lexical analyzer and an abstract syntax tree (AST) generator for a programming language. The lexical analyzer processes the source code to generate tokens, and the AST generator creates an abstract syntax tree from these tokens.
- Lexical Analysis: The
Lexing.cpp
file reads the source code frommyCode.txt
, generates a string of tokens, and stores them inLexing.txt
. - AST Generation: The
AST_nw.exe
executable reads the tokens fromLexing.txt
and generates an abstract syntax tree (AST).
-
Lexical Analysis:
- Input:
myCode.txt
(source code) - Output:
Lexing.txt
(tokens) - Process:
Lexing.cpp
reads the source code, generates tokens, and writes them toLexing.txt
.
- Input:
-
AST Generation:
- Input:
Lexing.txt
(tokens) - Output: AST (abstract syntax tree)
- Process:
AST_new.cpp
reads the tokens fromLexing.txt
and generates an AST.
- Input:
- C++: For the lexical analyzer and AST generator.