Skip to content

ItmoSE/Compiler

Repository files navigation

program     -> declaration* EOF ;
declaration -> "var" IDENT ( "=" expression )? ";" | statement ;

statement   -> whileStmt | ifStmt | printStmt | block | exprStmt ;
whileStmt   -> "while" "(" expression ")" statement ;
ifStmt      -> "if" "(" expression ")" statement ( "else" statement )? ;
printStmt   -> "print" expression ";" ;
block       -> "{" declaration* "}" ;
exprStmt    -> expression ";" ;

expression  -> assignment ;
assignment  -> IDENT "=" assignment | equality ;
equality    -> comparison ( ("==" | "!=") comparison )* ;
comparison  -> term ( ("<" | "<=" | ">" | ">=") term )* ;
term        -> factor ( ("+" | "-") factor )* ;
factor      -> unary ( ("*" | "/") unary )* ;
unary       -> ("-" | "!") unary | primary ;
primary     -> NUMBER | IDENT | "(" expression ")" ;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors