Last active
August 29, 2015 14:25
-
-
Save teqdruid/8a22f79cf3fe1d432c15 to your computer and use it in GitHub Desktop.
BNFC Output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PDefs.Program ::= [Def] ; | |
DefImport. Def ::= "import" [PackageName] ";" ; | |
DefPackage. Def ::= "package" [PackageName] ";" ; | |
DefModule. Def ::= "module" Id "{" [ModDef] "}" ; | |
terminator Def "" ; | |
DefStorage. ModDef ::= Type Id ";" ; | |
DefInput. ModDef ::= "input" Type Id ";" ; | |
DefOutput. ModDef ::= "output" Type Id ";" ; | |
DefEvent. ModDef ::= "event" "(" [EventParam] ")" "{" [Statement] "}" ; | |
terminator ModDef "" ; | |
rules EventParam ::= Type Id ; | |
separator EventParam "," ; | |
VarStmt. Statement ::= Type Id VarAssignment ; | |
AssignStmt. Statement ::= Id "=" Exp ";" ; | |
IfStmt. Statement ::= "if" "(" Exp ")" "{" [Statement] "}" ElseBlock ; | |
BlockStmt. Statement ::= "{" [Statement] "}" ; | |
PushStmt. Statement ::= Id "<-" Exp ";" ; | |
terminator Statement "" ; | |
VarAssign. VarAssignment ::= "=" Exp ";" ; | |
NoVarAssign.VarAssignment ::= ; | |
Else. ElseBlock ::= "else" Statement ; | |
NoElse. ElseBlock ::= ; | |
ETrue. Exp15 ::= "true" ; | |
EFalse. Exp15 ::= "false" ; | |
EInt. Exp15 ::= Integer ; | |
EDouble. Exp15 ::= Double ; | |
EString. Exp15 ::= String ; | |
EId. Exp15 ::= Id ; | |
EApp. Exp15 ::= Exp15 "(" [Exp] ")" ; | |
EArrAcc. Exp15 ::= Exp15 "[" Exp "]" ; | |
EDot. Exp15 ::= Exp15 "." Id ; | |
EParen. Exp15 ::= "(" Exp ")" ; | |
ETimes. Exp12 ::= Exp12 "*" Exp13 ; | |
EDiv. Exp12 ::= Exp12 "/" Exp13 ; | |
EPlus. Exp11 ::= Exp11 "+" Exp12 ; | |
EMinus. Exp11 ::= Exp11 "-" Exp12 ; | |
ELt. Exp9 ::= Exp9 "<" Exp10 ; | |
EGt. Exp9 ::= Exp9 ">" Exp10 ; | |
ELtEq. Exp9 ::= Exp9 "<=" Exp10 ; | |
EGtEq. Exp9 ::= Exp9 ">=" Exp10 ; | |
EEq. Exp8 ::= Exp8 "==" Exp9 ; | |
ENEq. Exp8 ::= Exp8 "!=" Exp9 ; | |
EAnd. Exp4 ::= Exp4 "&&" Exp5 ; | |
EOr. Exp3 ::= Exp3 "||" Exp4 ; | |
coercions Exp 15 ; | |
separator Exp "," ; | |
rules PackageName ::= Id ; | |
separator PackageName "." ; | |
token Id ((letter | '_') (letter | digit | '_')*) ; | |
Object. Type ::= Id; | |
comment "//" ; | |
comment "/*" "*/" ; | |
entrypoints Program; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This Bison file was machine-generated by BNFC */ | |
%{ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <iostream> | |
#include <algorithm> | |
#include "Absyn.H" | |
typedef struct yy_buffer_state *YY_BUFFER_STATE; | |
int yyparse(void); | |
int yylex(void); | |
YY_BUFFER_STATE yy_scan_string(const char *str); | |
void yy_delete_buffer(YY_BUFFER_STATE buf); | |
int yy_mylinenumber; | |
int initialize_lexer(FILE * inp); | |
int yywrap(void) | |
{ | |
return 1; | |
} | |
void yyerror(const char *str) | |
{ | |
extern char *yytext; | |
fprintf(stderr,"error: line %d: %s at %s\n", | |
yy_mylinenumber, str, yytext); | |
} | |
static Program* YY_RESULT_Program_ = 0; | |
Program* pProgram(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Program_; | |
} | |
} | |
Program* pProgram(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Program_; | |
} | |
} | |
static Def* YY_RESULT_Def_ = 0; | |
Def* pDef(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Def_; | |
} | |
} | |
Def* pDef(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Def_; | |
} | |
} | |
static ListDef* YY_RESULT_ListDef_ = 0; | |
ListDef* pListDef(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListDef_; | |
} | |
} | |
ListDef* pListDef(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListDef_; | |
} | |
} | |
static ModDef* YY_RESULT_ModDef_ = 0; | |
ModDef* pModDef(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ModDef_; | |
} | |
} | |
ModDef* pModDef(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ModDef_; | |
} | |
} | |
static ListModDef* YY_RESULT_ListModDef_ = 0; | |
ListModDef* pListModDef(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListModDef_; | |
} | |
} | |
ListModDef* pListModDef(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListModDef_; | |
} | |
} | |
static EventParam* YY_RESULT_EventParam_ = 0; | |
EventParam* pEventParam(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_EventParam_; | |
} | |
} | |
EventParam* pEventParam(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_EventParam_; | |
} | |
} | |
static ListEventParam* YY_RESULT_ListEventParam_ = 0; | |
ListEventParam* pListEventParam(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListEventParam_; | |
} | |
} | |
ListEventParam* pListEventParam(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListEventParam_; | |
} | |
} | |
static Statement* YY_RESULT_Statement_ = 0; | |
Statement* pStatement(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Statement_; | |
} | |
} | |
Statement* pStatement(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Statement_; | |
} | |
} | |
static ListStatement* YY_RESULT_ListStatement_ = 0; | |
ListStatement* pListStatement(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListStatement_; | |
} | |
} | |
ListStatement* pListStatement(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListStatement_; | |
} | |
} | |
static VarAssignment* YY_RESULT_VarAssignment_ = 0; | |
VarAssignment* pVarAssignment(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_VarAssignment_; | |
} | |
} | |
VarAssignment* pVarAssignment(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_VarAssignment_; | |
} | |
} | |
static ElseBlock* YY_RESULT_ElseBlock_ = 0; | |
ElseBlock* pElseBlock(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ElseBlock_; | |
} | |
} | |
ElseBlock* pElseBlock(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ElseBlock_; | |
} | |
} | |
static Exp* YY_RESULT_Exp_ = 0; | |
Exp* pExp(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Exp_; | |
} | |
} | |
Exp* pExp(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Exp_; | |
} | |
} | |
static ListExp* YY_RESULT_ListExp_ = 0; | |
ListExp* pListExp(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListExp_; | |
} | |
} | |
ListExp* pListExp(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListExp_; | |
} | |
} | |
static PackageName* YY_RESULT_PackageName_ = 0; | |
PackageName* pPackageName(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_PackageName_; | |
} | |
} | |
PackageName* pPackageName(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_PackageName_; | |
} | |
} | |
static ListPackageName* YY_RESULT_ListPackageName_ = 0; | |
ListPackageName* pListPackageName(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListPackageName_; | |
} | |
} | |
ListPackageName* pListPackageName(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_ListPackageName_; | |
} | |
} | |
static Type* YY_RESULT_Type_ = 0; | |
Type* pType(FILE *inp) | |
{ | |
yy_mylinenumber = 1; | |
initialize_lexer(inp); | |
if (yyparse()) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Type_; | |
} | |
} | |
Type* pType(const char *str) | |
{ | |
YY_BUFFER_STATE buf; | |
int result; | |
yy_mylinenumber = 1; | |
initialize_lexer(0); | |
buf = yy_scan_string(str); | |
result = yyparse(); | |
yy_delete_buffer(buf); | |
if (result) | |
{ /* Failure */ | |
return 0; | |
} | |
else | |
{ /* Success */ | |
return YY_RESULT_Type_; | |
} | |
} | |
%} | |
%union | |
{ | |
int int_; | |
char char_; | |
double double_; | |
char* string_; | |
Program* program_; | |
Def* def_; | |
ListDef* listdef_; | |
ModDef* moddef_; | |
ListModDef* listmoddef_; | |
EventParam* eventparam_; | |
ListEventParam* listeventparam_; | |
Statement* statement_; | |
ListStatement* liststatement_; | |
VarAssignment* varassignment_; | |
ElseBlock* elseblock_; | |
Exp* exp_; | |
ListExp* listexp_; | |
PackageName* packagename_; | |
ListPackageName* listpackagename_; | |
Type* type_; | |
} | |
%token _ERROR_ | |
%token _SYMB_0 // ; | |
%token _SYMB_1 // { | |
%token _SYMB_2 // } | |
%token _SYMB_3 // ( | |
%token _SYMB_4 // ) | |
%token _SYMB_5 // , | |
%token _SYMB_6 // = | |
%token _SYMB_7 // <- | |
%token _SYMB_8 // [ | |
%token _SYMB_9 // ] | |
%token _SYMB_10 // . | |
%token _SYMB_11 // * | |
%token _SYMB_12 // / | |
%token _SYMB_13 // + | |
%token _SYMB_14 // - | |
%token _SYMB_15 // < | |
%token _SYMB_16 // > | |
%token _SYMB_17 // <= | |
%token _SYMB_18 // >= | |
%token _SYMB_19 // == | |
%token _SYMB_20 // != | |
%token _SYMB_21 // && | |
%token _SYMB_22 // || | |
%token _SYMB_23 // else | |
%token _SYMB_24 // event | |
%token _SYMB_25 // false | |
%token _SYMB_26 // if | |
%token _SYMB_27 // import | |
%token _SYMB_28 // input | |
%token _SYMB_29 // module | |
%token _SYMB_30 // output | |
%token _SYMB_31 // package | |
%token _SYMB_32 // true | |
%token<string_> _SYMB_33 // Id | |
%type <program_> Program | |
%type <def_> Def | |
%type <listdef_> ListDef | |
%type <moddef_> ModDef | |
%type <listmoddef_> ListModDef | |
%type <eventparam_> EventParam | |
%type <listeventparam_> ListEventParam | |
%type <statement_> Statement | |
%type <liststatement_> ListStatement | |
%type <varassignment_> VarAssignment | |
%type <elseblock_> ElseBlock | |
%type <exp_> Exp15 | |
%type <exp_> Exp12 | |
%type <exp_> Exp11 | |
%type <exp_> Exp9 | |
%type <exp_> Exp8 | |
%type <exp_> Exp4 | |
%type <exp_> Exp3 | |
%type <exp_> Exp | |
%type <exp_> Exp1 | |
%type <exp_> Exp2 | |
%type <exp_> Exp5 | |
%type <exp_> Exp6 | |
%type <exp_> Exp7 | |
%type <exp_> Exp10 | |
%type <exp_> Exp13 | |
%type <exp_> Exp14 | |
%type <listexp_> ListExp | |
%type <packagename_> PackageName | |
%type <listpackagename_> ListPackageName | |
%type <type_> Type | |
%start Program | |
%token<string_> _STRING_ | |
%token<int_> _INTEGER_ | |
%token<double_> _DOUBLE_ | |
%% | |
Program : ListDef { $$ = new PDefs($1); $$->line_number = yy_mylinenumber; YY_RESULT_Program_= $$; } | |
; | |
Def : _SYMB_27 ListPackageName _SYMB_0 { std::reverse($2->begin(),$2->end()) ;$$ = new DefImport($2); $$->line_number = yy_mylinenumber; } | |
| _SYMB_31 ListPackageName _SYMB_0 { std::reverse($2->begin(),$2->end()) ;$$ = new DefPackage($2); $$->line_number = yy_mylinenumber; } | |
| _SYMB_29 _SYMB_33 _SYMB_1 ListModDef _SYMB_2 { $$ = new DefModule($2, $4); $$->line_number = yy_mylinenumber; } | |
; | |
ListDef : /* empty */ { $$ = new ListDef(); } | |
| ListDef Def { $1->push_back($2) ; $$ = $1 ; } | |
; | |
ModDef : Type _SYMB_33 _SYMB_0 { $$ = new DefStorage($1, $2); $$->line_number = yy_mylinenumber; } | |
| _SYMB_28 Type _SYMB_33 _SYMB_0 { $$ = new DefInput($2, $3); $$->line_number = yy_mylinenumber; } | |
| _SYMB_30 Type _SYMB_33 _SYMB_0 { $$ = new DefOutput($2, $3); $$->line_number = yy_mylinenumber; } | |
| _SYMB_24 _SYMB_3 ListEventParam _SYMB_4 _SYMB_1 ListStatement _SYMB_2 { std::reverse($3->begin(),$3->end()) ;$$ = new DefEvent($3, $6); $$->line_number = yy_mylinenumber; } | |
; | |
ListModDef : /* empty */ { $$ = new ListModDef(); } | |
| ListModDef ModDef { $1->push_back($2) ; $$ = $1 ; } | |
; | |
EventParam : Type _SYMB_33 { $$ = new EventParam1($1, $2); $$->line_number = yy_mylinenumber; } | |
; | |
ListEventParam : /* empty */ { $$ = new ListEventParam(); } | |
| EventParam { $$ = new ListEventParam() ; $$->push_back($1); } | |
| EventParam _SYMB_5 ListEventParam { $3->push_back($1) ; $$ = $3 ; } | |
; | |
Statement : Type _SYMB_33 VarAssignment { $$ = new VarStmt($1, $2, $3); $$->line_number = yy_mylinenumber; } | |
| _SYMB_33 _SYMB_6 Exp _SYMB_0 { $$ = new AssignStmt($1, $3); $$->line_number = yy_mylinenumber; } | |
| _SYMB_26 _SYMB_3 Exp _SYMB_4 _SYMB_1 ListStatement _SYMB_2 ElseBlock { $$ = new IfStmt($3, $6, $8); $$->line_number = yy_mylinenumber; } | |
| _SYMB_1 ListStatement _SYMB_2 { $$ = new BlockStmt($2); $$->line_number = yy_mylinenumber; } | |
| _SYMB_33 _SYMB_7 Exp _SYMB_0 { $$ = new PushStmt($1, $3); $$->line_number = yy_mylinenumber; } | |
; | |
ListStatement : /* empty */ { $$ = new ListStatement(); } | |
| ListStatement Statement { $1->push_back($2) ; $$ = $1 ; } | |
; | |
VarAssignment : _SYMB_6 Exp _SYMB_0 { $$ = new VarAssign($2); $$->line_number = yy_mylinenumber; } | |
| /* empty */ { $$ = new NoVarAssign(); $$->line_number = yy_mylinenumber; } | |
; | |
ElseBlock : _SYMB_23 Statement { $$ = new Else($2); $$->line_number = yy_mylinenumber; } | |
| /* empty */ { $$ = new NoElse(); $$->line_number = yy_mylinenumber; } | |
; | |
Exp15 : _SYMB_32 { $$ = new ETrue(); $$->line_number = yy_mylinenumber; } | |
| _SYMB_25 { $$ = new EFalse(); $$->line_number = yy_mylinenumber; } | |
| _INTEGER_ { $$ = new EInt($1); $$->line_number = yy_mylinenumber; } | |
| _DOUBLE_ { $$ = new EDouble($1); $$->line_number = yy_mylinenumber; } | |
| _STRING_ { $$ = new EString($1); $$->line_number = yy_mylinenumber; } | |
| _SYMB_33 { $$ = new EId($1); $$->line_number = yy_mylinenumber; } | |
| Exp15 _SYMB_3 ListExp _SYMB_4 { std::reverse($3->begin(),$3->end()) ;$$ = new EApp($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp15 _SYMB_8 Exp _SYMB_9 { $$ = new EArrAcc($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp15 _SYMB_10 _SYMB_33 { $$ = new EDot($1, $3); $$->line_number = yy_mylinenumber; } | |
| _SYMB_3 Exp _SYMB_4 { $$ = new EParen($2); $$->line_number = yy_mylinenumber; } | |
| _SYMB_3 Exp _SYMB_4 { $$ = $2; } | |
; | |
Exp12 : Exp12 _SYMB_11 Exp13 { $$ = new ETimes($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp12 _SYMB_12 Exp13 { $$ = new EDiv($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp13 { $$ = $1; } | |
; | |
Exp11 : Exp11 _SYMB_13 Exp12 { $$ = new EPlus($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp11 _SYMB_14 Exp12 { $$ = new EMinus($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp12 { $$ = $1; } | |
; | |
Exp9 : Exp9 _SYMB_15 Exp10 { $$ = new ELt($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp9 _SYMB_16 Exp10 { $$ = new EGt($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp9 _SYMB_17 Exp10 { $$ = new ELtEq($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp9 _SYMB_18 Exp10 { $$ = new EGtEq($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp10 { $$ = $1; } | |
; | |
Exp8 : Exp8 _SYMB_19 Exp9 { $$ = new EEq($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp8 _SYMB_20 Exp9 { $$ = new ENEq($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp9 { $$ = $1; } | |
; | |
Exp4 : Exp4 _SYMB_21 Exp5 { $$ = new EAnd($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp5 { $$ = $1; } | |
; | |
Exp3 : Exp3 _SYMB_22 Exp4 { $$ = new EOr($1, $3); $$->line_number = yy_mylinenumber; } | |
| Exp4 { $$ = $1; } | |
; | |
Exp : Exp1 { $$ = $1; } | |
; | |
Exp1 : Exp2 { $$ = $1; } | |
; | |
Exp2 : Exp3 { $$ = $1; } | |
; | |
Exp5 : Exp6 { $$ = $1; } | |
; | |
Exp6 : Exp7 { $$ = $1; } | |
; | |
Exp7 : Exp8 { $$ = $1; } | |
; | |
Exp10 : Exp11 { $$ = $1; } | |
; | |
Exp13 : Exp14 { $$ = $1; } | |
; | |
Exp14 : Exp15 { $$ = $1; } | |
; | |
ListExp : /* empty */ { $$ = new ListExp(); } | |
| Exp { $$ = new ListExp() ; $$->push_back($1); } | |
| Exp _SYMB_5 ListExp { $3->push_back($1) ; $$ = $3 ; } | |
; | |
PackageName : _SYMB_33 { $$ = new PackageNameId($1); $$->line_number = yy_mylinenumber; } | |
; | |
ListPackageName : /* empty */ { $$ = new ListPackageName(); } | |
| PackageName { $$ = new ListPackageName() ; $$->push_back($1); } | |
| PackageName _SYMB_10 ListPackageName { $3->push_back($1) ; $$ = $3 ; } | |
; | |
Type : _SYMB_33 { $$ = new Object($1); $$->line_number = yy_mylinenumber; } | |
; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment