0% found this document useful (0 votes)
31 views

C +grammar+ +updated

This document defines the grammar for a C-like programming language, specifying the structure of programs, functions, statements, expressions, and types. It defines non-terminals like Program, VarDeclList, StmtList, Expr and terminals like int, float, if, else, while, break, return, ;, =, +, -, *, /, <, >, ==, !=, &&, ||.

Uploaded by

Anum Mansoor
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

C +grammar+ +updated

This document defines the grammar for a C-like programming language, specifying the structure of programs, functions, statements, expressions, and types. It defines non-terminals like Program, VarDeclList, StmtList, Expr and terminals like int, float, if, else, while, break, return, ;, =, +, -, *, /, <, >, ==, !=, &&, ||.

Uploaded by

Anum Mansoor
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

C-- Grammar

Program VarDeclList VarDecl Num FunDeclList FunDecl ParamDeclList ParamDeclListTail ParamDecl Block Type StmtList VarDeclList FunDeclList epsilon VarDecl VarDeclList Type identifier ; Type identifier [ Num ] ; intNum floatNum FunDecl FunDecl FunDeclList Type identifier ( ParamDecList ) Block epsilon ParamDeclListTail ParamDecl ParamDecl , ParamDeclListTail Type identifier Type identifier[] { VarDeclList StmtList } int float Stmt Stmt StmtList Primary Stmt ; Expr ; return Expr ; read identifier ; write Expr ; writeln ; break ; if ( Expr ) Stmt else Stmt if ( Expr ) Stmt while ( Expr ) Stmt Block Primary UnaryOp Expr Expr BinOp Expr identifier = Expr identifier [ Expr ] = Expr identifier Num ( Expr ) identifier ( ExprList ) identifier [ Expr ] epsilon ExprListTail Expr Expr , ExprListTail addOp not addOp mulOp relOp and or

Expr

ExprList ExprListTail UnaryOp BinOp

You might also like