This repository has been archived by the owner on Jul 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Alexandru Stoica edited this page Dec 19, 2017
·
6 revisions
program ->
program -> block program
block ->
block -> declarations
block -> statements
declarations ->
declarations -> declaration declarations
declaration -> type identifier "=" expression
declaration -> type identifier
type -> "Int"
type -> "String"
identifier -> 0
constant -> 1
constant -> " 1 "
statements ->
statements -> statement statements
statement -> assignment
statement -> control_statement
statement -> io_statement
assignment -> identifier "=" expression ";"
io_statement -> "read" "(" ")" ";"
io_statement -> "print" "(" expression ")" ";"
control_statement -> conditional_statement
control_statement -> loop_statement
conditional_statement -> "if" "(" condition ")" "{" block "}"
conditional_statement -> conditional_statement "{" "else" "if" "(" condition ")" "{" block "}" "}"
conditional_statement -> conditional_statement "{" "else" "{" block"}" "}"
condition -> expression
condition -> expression relation expression
expression -> sign_atom
expression -> "(" expression ")"
expression -> expression operation atom
sign_atom -> atom
sign_atom -> "-" atom
operation -> low_level_operation
operation -> high_level_operation
low_level_operation -> "+"
low_level_operation -> "-"
high_level_operation -> "*"
high_level_operation -> "/"
high_level_operation -> relation
atom -> identifier
atom -> constant
relation -> "=="
relation -> "!="
relation -> ">"
relation -> "<"
relation -> "<="
relation -> ">="
loop_statement -> "for" "(" type identifier ":" range ")" "{" block "}"
range -> identifier
range -> "range" "(" constant ":" constant ")"