OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [zasm.y] - Diff between revs 26 and 34

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 26 Rev 34
Line 80... Line 80...
 
 
%left BOOLEANOR
%left BOOLEANOR
%left BOOLEANAND
%left BOOLEANAND
%left BITWISEOR BITWISEXOR
%left BITWISEOR BITWISEXOR
%left BITWISEAND
%left BITWISEAND
 
%left '%'
%left PLUS MINUS
%left PLUS MINUS
%left TIMES '/'
%left TIMES '/'
 
 
%% /* The grammar follows */
%% /* The grammar follows */
 
 
Line 381... Line 382...
        }
        }
;
;
 
 
expr:
expr:
        value                   { $$ = $1; }
        value                   { $$ = $1; }
|       MINUS value             { $$ = new AST_BRANCH('-',new AST_NUMBER(0), $2); }
|       MINUS value %prec TIMES  { $$ = new AST_BRANCH('-',new AST_NUMBER(0), $2); }
|       expr PLUS value         { $$ = new AST_BRANCH('+',$1,$3); }
|       expr PLUS expr          { $$ = new AST_BRANCH('+',$1,$3); }
|       expr MINUS value        { $$ = new AST_BRANCH('-',$1,$3); }
|       expr MINUS expr         { $$ = new AST_BRANCH('-',$1,$3); }
|       expr TIMES value        { $$ = new AST_BRANCH('*',$1,$3); }
|       expr TIMES expr         { $$ = new AST_BRANCH('*',$1,$3); }
|       expr BOOLEANOR value    { $$ = new AST_BRANCH('o',$1,$3); }
|       expr '/' expr           { $$ = new AST_BRANCH('/',$1,$3); }
|       expr BITWISEOR value    { $$ = new AST_BRANCH('|',$1,$3); }
|       expr '%' expr           { $$ = new AST_BRANCH('%',$1,$3); }
|       expr BOOLEANAND value   { $$ = new AST_BRANCH('a',$1,$3); }
|       expr BOOLEANOR expr     { $$ = new AST_BRANCH('o',$1,$3); }
|       expr BITWISEAND value   { $$ = new AST_BRANCH('&',$1,$3); }
|       expr BITWISEOR expr     { $$ = new AST_BRANCH('|',$1,$3); }
|       expr BITWISEXOR value   { $$ = new AST_BRANCH('^',$1,$3); }
|       expr BOOLEANAND expr    { $$ = new AST_BRANCH('a',$1,$3); }
 
|       expr BITWISEAND expr    { $$ = new AST_BRANCH('&',$1,$3); }
 
|       expr BITWISEXOR expr    { $$ = new AST_BRANCH('^',$1,$3); }
|       '(' expr ')'            { $$ = $2; }
|       '(' expr ')'            { $$ = $2; }
;
;
        /* expr OR  (|) value */
        /* expr OR  (|) value */
        /* expr XOR (^) value */
        /* expr XOR (^) value */
        /* expr AND (&) value */
        /* expr AND (&) value */

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.