I receive a 20 shift/reduce conflicts error. I handled the operator precedence by declaring them separately. I'm not sure about exprList and propertyList, I tried different versions of them but the error would not change.
%#include<studio.h>
void yyerror( const char *s)
{
printf("%s\n",s);
}
%}
%token tFOR tIN tFUNCTION tSEMICOLON tLPAR tLBRKT tLBRACE tCOLON tINT
tREAL tSTRING tWHILE tVAR tELSE tCOMMA tRPAR tRBRKT tRBRACE tEQ tNOT tIF
tIDENT
%token tGT
%token tLT
%token tEQCHECK
%left tPLUS tMINUS
%left tSTAR
%%
statementList:statement|statementList statement | statementList
tSEMICOLON statement;
statement: assign | if | expr |statementBlock | while |for | functionCall
| functionDeclaration;
assign: tIDENT tEQ expr | tVAR tIDENT tEQ expr;
if: ifPart elsePart;
ifPart: tIF tLPAR expr tRPAR statementBlock;
elsePart: tELSE statementBlock;
while: tWHILE tLPAR expr tRPAR statementBlock;
for: tFOR tLPAR tVAR tIDENT tIN expr tRPAR statementBlock | tFOR tLPAR
expr tRPAR statementBlock;
functionDeclaration: tFUNCTION tIDENT tLPAR exprList tRPAR statementBlock
| tFUNCTION tIDENT tLPAR tRPAR statementBlock;
statementBlock: tLBRACE statementList tRBRACE;
functionCall:tIDENT tLPAR exprList tRPAR | tIDENT tLPAR tRPAR;
expr: tIDENT | tSTRING |tLBRKT tRBRKT | tLBRKT exprList tRBRKT
|tLBRACE tRBRACE | tLBRACE propertyList tRBRACE | tNOT expr |
expr tPLUS term | expr tMINUS term | term |
expr tEQCHECK expr | expr tLT expr | expr tGT expr;
exprList: expr | exprList tCOMMA expr;
propertyList: tIDENT tCOLON expr
| propertyList tCOMMA tIDENT tCOLON expr;
term:term tSTAR factor | factor;
factor: tREAL| tINT;
%%