gitignore

This commit is contained in:
Rusty Striker 2024-03-26 21:02:54 +02:00
commit b17f895f0a
Signed by: RustyStriker
GPG key ID: 87E4D691632DFF15
7 changed files with 470 additions and 0 deletions

31
cpq.py Normal file
View file

@ -0,0 +1,31 @@
import sly
# for ease of reading, the compiler is broken down to multiple files
# parser.py for the parser
# lexer.py for the lexer
# and helper.py for helper functions(such as print_err)
from lexer import Lexer
from parser import Parser
from helper import print_err
print_err('Aviv Romem')
lexer = Lexer()
parser = Parser()
text = '''
a: int;
{
while(a < 10) {
a = a + 1;
if(a == 5)
break;
else
a = a + 0;
}
}
'''
parser.parse(lexer.tokenize(text))
for l, t in enumerate(parser.lines):
print(l,':',t)