Skip to content

fbluewhale/compiler_HW1_UI_1401

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple lexer for below grammars

stmt -> compound-stmt | if-stmt | while-stmt | assign-stmt;
compound-stmt -> { stmt-list }
if-stmt -> if expr stmt | if expr stmt else stmt
while-stmt -> while expr do stmt
assign-stmt -> id= expr
expr -> expr + expr | expr – expr | expr * expr | expr / expr | expr < expr | expr <= expr | expr > expr |
expr >= expr | expr != expr | expr == expr | (expr) | id | num
stmt-list -> stmt stmt-list | stmt

usage

execute python script from main directory:

$ python3.10 main.py

read p.txt then tokenized it

#TODO []sweeping :)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages