This repository contains the implementation of a didactic compiler for the Cafezinho language, developed as part of the activities for the Compilers - 1 course in the Bachelor's Degree in Computer Science at the Federal University of Goiás.
- Lexical Analyzer: Implemented using Flex, generating C code.
- Syntax Analyzer: Implemented using Bison.
- Intermediate Representation: Abstract syntax tree (ternary).
- Final Compilation: The syntax analyzer uses the lexical analyzer to process the input code and generate the syntax tree.
- Lexical Analysis: Identification of tokens based on the definitions of the Cafezinho grammar.
- Syntax Analysis: Construction of the abstract syntax tree from the tokens generated in the lexical analysis.
- Execution: Generation of an executable that processes input files containing code in Cafezinho.
- The symbol table has not been implemented.
- Complete semantic analysis has not been performed.
- The final Assembly code has not been generated.
lexico.l
: Specification file for the Flex lexical analyzer generator.Sintatico.y
: Specification file for the Bison syntax analyzer generator.Makefile
: Commands for generating the lexical and syntax analyzers, compiling, and linking the main program.
To compile and run the project, follow these steps:
-
Compile the project:
make
-
Run the analyzer:
./cafezinho <input_file>
For more details, refer to the full specifications of the assignments and the provided grammars in the PDF files:
Especificação dos analisadores léxicos e sintáticos.pdf