This is an attempt to implement a truncated version of a Python3 Compiler. It's a Lexical, Syntax and Sematic Analyzer mix.
Apostolos Kontarinis
Agisilaos Kounelis
Ioannis Prokopiou
Ioannis Sina
- Variables: initialization (int, float, string), overriding variables with the same name, execution of arithmetic operations (* / - +), support order of operations.
- Dictionaries: initialization(keys: primitive types, values: everything), implementation of items() and setdefault(keyname, value=None) functions.
- print(): implementation of the function. Fully compatible with variables and dictionaries.
- Comments
- Modules Import
- Classes: definition, constructor definition, object creation.
- Functions: definiction, call.
- Conditional Statements: if, elif, else.
- For Loops
- Lambda Functions
$ flex calc.l
$ bison -y -d calc.y
$ gcc -c y.tab.c lex.yy.c
$ gcc linked_list.c -c
$ gcc linked_list.c y.tab.c lex.yy.c -o calc -lm
$ ./calc input.py
$ alias python4='clear && flex calc.l && bison -y -d calc.y && gcc -c y.tab.c lex.yy.c && gcc linked_list.c -c && gcc y.tab.c lex.yy.c linked_list.c -o calc -lm && ./calc'
$ python4 input.py