- program -> declaration-list
- declaration-list -> declaration-list declaration | declaration
- declaration -> var-declaration | fun-declaration
- var-declaration -> type-specifier ID;
- type-specifier -> int | void
- fun-declaration -> type-specifier ID ( params ) compound-stmt
- params -> param-list | void
- param-list -> param-list, param | param
- param -> type-specifier ID
- compound-stmt -> { local-declarations statement-list }
- local-declarations -> local-declarations var-declaration | empty
- statement-list -> statement-list statement | empty
- statement -> expression-stmt | compound-stmt | selection-stmt | iteration-stmt | return-stmt
- selection-stmt -> if ( expression ) statement | if ( expression ) statement else statement
- iteration-stmt -> while ( expression ) statement
- return-stmt -> return ; | return expression;
- expression-stmt -> expression; | ;
- expression -> var = expression | simple-expression;
- var -> ID
- simple-expression -> additive-expression relop additive-expression | additive-expression
- relop -> <= | < | > | >= | == | !=
- additive-expression -> additive-expression addop term | term
- addop -> + | -
- term -> term mulop factor | factor
- mulop -> * | /
- factor -> ( expression ) | var | call | NUM // factor
- call -> ID ( args )
- args -> arg-list | empty
- arg-list -> arg-list, expression | expression
-
Notifications
You must be signed in to change notification settings - Fork 0
Yuukirn/c--
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published