Вы находитесь на странице: 1из 6

entrypoints Prog;

OpMult. Binopmul ::= "*";

OpDiv. Binopmul ::= "/";

OpSoma. Binopsum ::= "+";

OpMenos. Binopsum ::= "-";

RelLeft. Relop ::= ">";

RelRight. Relop ::= "<";

RelDif. Relop ::= "!=";

RelEq. Relop ::= "==";

RelLEq. Relop ::= ">=";

RelREq. Relop ::= "<=";

LOpAnd. Logicalop ::= "&&";

LOpOr. Logicalop ::= "||";

OpIf. IF ::= "if";

OpThen. THEN ::= "then";

OpElse. ELSE ::= "else";

OpWhil. WHILE ::= "while";

OfFor. FOR ::= "for";

OpRet. RETURN ::= "return";

OpVoid.VOID ::= "void";


OpExt. EXTERN ::= "extern";

Com1.Comment ::= "/*" "*/";

Com2.Comment ::= "//";

P1. ParenL ::= "(";

P2. ParenR ::= ")";

Co1. ColchL ::= "[";

Co2. ColchR ::= "]";

Ch1. ChaveL ::= "{";

Ch2. ChaveR ::= "}";

ExprRel. Expr1 ::= Expr Relop Expr;

ExprLog. Expr2 ::= Expr Logicalop Expr;

ExprSum. Expr3 ::= Expr Binopsum Expr;

ExprMul. Expr4 ::= Expr Binopmul Expr;

ExEprNot. Expr5 ::= "!" Expr;

ExprNeg. Expr6 ::= "-" Expr;

ExprVar. Expr7 ::= Ident Expr_list;

ExprVec. Expr8 ::= Ident ColchL Expr ColchR;

ExprPare. Expr9 ::= ParenL Expr ParenR;

ExprFunc. Expr10 ::= Ident ParenL Expr ParenR;

ExprTypeC. Expr11 ::= Char;

ExprTypeI. Expr12 ::= Integer;

ExprTypeS. Expr13 ::= String;


coercions Expr 13;

ExListEmpty. Expr_list ::= ;

ExList. Expr_list ::= Expr Expr_list;

separator Expr_list ",";

Nulo. VOID ::= "void";

TChar. Type ::= "char";

TInt. Type ::= "int";

Entry. Prog ::= [Prog1];

PDecl. Prog1 ::= Dcl ";";

PFunc. Prog1 ::= Func;

--terminator Prog1 "";

separator nonempty Prog1 "";

Decl. Dcl ::= Type Var_decl Var_declist;

ExDecl. Dcl ::= EXTERN Type Ident ParenL Parm_types


ParenR Parm_typelist;

ExVoidecl. Dcl ::= EXTERN VOID Ident ParenL Parm_types


ParenR Parm_typelist;

FunDecl. Dcl ::= Type Ident ParenL Parm_types ParenR


Parm_typelist;

FunVoidDecl. Dcl ::= VOID Ident ParenL Parm_types ParenR


Parm_typelist;

VListEmpty. Var_declist ::= ;

VList. Var_declist ::= Var_decl Var_declist;

--terminator Var_declist ;

separator nonempty Var_declist ",";

PListEmpty. Parm_typelist ::= ;

PList. Parm_typelist ::= Ident ParenL Parm_types ParenR Parm_typelist;

separator nonempty Parm_typelist ",";

Var. Var_decl ::= Ident;

VarVec. Var_decl ::= Ident ColchL Integer ColchR;

PTVoidID. Parm_types ::= VOID Ident;

PTColch. Parm_types ::= Type Ident ColchL ColchR Types_list;

PT. Parm_types ::= Type Ident Types_list;

separator nonempty Parm_types ",";

--terminator Parm_types "";


FType. Func ::= Type Ident ParenL Parm_types ParenR ChaveL Types_list
Stmt_list ChaveR;

FVoid. Func ::= VOID Ident Ident ParenL Parm_types ParenR ChaveL
Types_list Stmt_list ChaveR;

TLEmpty. Types_list ::= ;

TL. Types_list ::= Type Var_decl Var_declist ";" Types_list;

StLEmpty. Stmt_list ::= ;

StL. Stmt_list ::= Stmt Stmt_list;

ExLEmpty. Expr_list ::= ;

ExL. Expr_list ::= Expr Expr_list;

ExprCol. Expr_col ::= ColchL Expr ColchR;

Assign0. Assg ::= ;

Assign1. Assg ::= Ident Expr_col "=" Expr;

AssBin0. Assg_bin ::= ;

AssBin1. Assg_bin ::= Assg;

ExprBin0. Expr_bin ::= ;

ExprBin1. Expr_bin ::= Expr;

StIf. Stmt ::= IF ParenL Expr ParenR Stmt;


StIfElse.Stmt ::= IF ParenL Expr ParenR Stmt ELSE Stmt;

StWhile. Stmt ::= WHILE ParenL Expr ParenR Stmt;

StFor. Stmt ::= FOR ParenL Assg_bin ";" Expr_bin ";" Assg_bin ParenR
Stmt;

StRet. Stmt ::= RETURN Expr_bin;

StAssg. Stmt ::= Assg ";";

StParen. Stmt ::= Ident ParenL Expr_list ParenR ";";

StChave. Stmt ::= ChaveL Stmt_list ChaveR ;

StPv. Stmt ::= ";";

separator Expr_list ",";

Вам также может понравиться