Convert your C code to Python using a C++ program
#define STUDENT "Gabriel de Paula"
#define SUBJECT "Compiladores"
#define PROFESSOR "Flávio Schiavoni"
#define SEMESTER "2025/1"
Generate the executable:
makeRun the executable
./bin/compiler <source_file.c> <output_file.py>
- Must start with an alphabetic character or an underscore (
_). - Can contain any combination of letters, digits, and underscores after the first character.
- Must start with a digit.
- Can contain one dot
.to separate the integer and decimal parts. - May end with the letter
fto represent afloat.
- Must start and end with a double quote
". - The sequence
\"is used to escape a double quote within the string.
- Supported operators include:
*,/,%,+,-,==,!=,&&,||,=,+=,-=,*=,/=,%=,&,|,.,>,<,>=,<=,! - If an operator consists of multiple characters, each individual character must also be a valid operator on its own.
- Token-generating separators:
(,),{,},[,],;,, - Ignored separators (do not generate tokens):
whitespace, newline\n, tab\t
-
Line comments start with
// -
Block comments start with
/*and end with*/
This project was built only for educational purposes, probably will never be finished, but was a great way to learn more about compilers.
- Lexical Analyzer
- Syntax Analyzer
- Semantic Analyzer
- Code Generation (poor)
- Optimization