Using python3
program = type, identifier, "(" ((type, identifier), ',')+ ")", commands ;
commands = “{”, command, “;”, { command, “;” }, “}” ;
command = assignment | commands | printf | if | while | declaration ;
assignment = identifier, “=”, expression | scanf | function_call ;
function_call = identifier, "(" ,((expression) ",")+, ")" ;
scanf = "scanf", “(”,“)” ;
printf = "printf", “(”, expression, “)” ;
if = "if", “(”, bool_expression, “)”, commands ;
while = "while",“(”, bool_expression, “)”, commands ;
declaration = type, identifier, { "(" ((type, identifier), ',')+ ")", commands };
return = "return", "(", { ((expression), ",")+ },")";
type = "int" | "char" | "void" ;
expression = term, { (“+” | “-”), term } ;
term = factor, { (“*” | “/”), factor } ;
factor = (“+” | “-”), factor | num | “(”, expression, “)” | identifier ;
bool_expression = bool_term, { "||", bool_term } ;
bool_term = bool_factor, { “&&”, bool_factor } ;
bool_factor = { expression, (">" | "<" | "==" ), expression } | bool_factor ;
identifier = letter, { letter | digit | “_” } ;
num = digit, { digit } ;
letter = ( a | ... | z | A | ... | Z ) ;
digit = ( 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 ) ;
![program](DS/DS1.png =250x)
![DS](DS/DS2.png =250x)
![DS](DS/DS3.png =250x)
![DS](DS/DS4.png =250x)
![DS](DS/DS5.png =250x)
![DS](DS/DS6.png =250x)
![DS](DS/DS7.png =250x)
![DS](DS/DS8.png =250x)
![DS](DS/DS9.png =250x)
![DS](DS/DS10.png =250x)
![DS](DS/DS11.png =250x)
![DS](DS/DS12.png =250x)
![DS](DS/DS13.png =250x)
![DS](DS/DS14.png =250x)
![DS](DS/DS15.png =250x)
![DS](DS/DS16.png =250x)
![DS](DS/DS17.png =250x)