Skip to content

git-bauerseb/bcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grammar

global-declarations ::= global-declarations | global-declaration global-declarations ;

global-declaration ::= function-declaration | var-declaration;

type ::= type-keyword opt-pointer;

type-keyword ::= 'void' | 'char' | 'int' | 'long' ;

opt-pointer ::= | '*' opt-pointer;

statements ::= statement | statement statements ;

statement ::= 'print' expression ';' | 'int' identifier ';' | identifier '=' expression ';' | if-statement | while-statement | for-statement ;

return-statement ::= 'return' (expression ?) ';' ;

function-call ::= identifier '(' expression ')' ;

function-declaration ::= 'void' identifier '(' ')' compound-statement ;

for-statement ::= 'for' '(' init-statement ';' bool-expression ';' post-statement ')' compound-statement ;

while-statement ::= 'while' '(' expression ')' compound-statement ;

if-statement ::= if-head | if-head 'else' compound-statement ;

if-head ::= 'if' '(' expression ')' compound-statement;

compound-statement ::= '{' '}' | '{' statements '}' ;

identifier ::= T_IDENT ;

expression ::= equals;

equals ::= comparison ('==' comparison ?) | comparison ('!=' comparison ?) ;

comparison ::= term ('<' term ?) | term ('<=' term ?) | term ('>' term ?) | term ('>=' term ?) ;

term ::= factor ('+' factor ?) | factor ('-' factor ?) ;

factor ::= number '*' number | number '/' number ;

number ::= T_INTLIT ;

Assembly

About

C compiler written in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages