calculation priority
This commit is contained in:
parent
843ba8b034
commit
35cccd3ad5
3 changed files with 3 additions and 4 deletions
|
@ -41,4 +41,3 @@ $ make test
|
|||
## Problèmes connus
|
||||
|
||||
- Pas de parenthèses pour les calculs
|
||||
- Pas de prioriétés de calculs
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
%token Land Lor
|
||||
%token Lif Lelse Lwhile
|
||||
|
||||
%left Ladd Lsub Lmul Ldiv Lrem Lseq Lsge Lsgt Lsle Lslt Lsne
|
||||
%left Land Lor
|
||||
%left Ladd Lsub Lseq Lsge Lsgt Lsle Lslt Lsne Land Lor
|
||||
%left Lmul Ldiv Lrem
|
||||
|
||||
%type <Ast.Syntax.prog> prog
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
int main () {
|
||||
int res = 13 * -100 - 20 + 8;
|
||||
int res = 8 - 20 - 13 * 100;
|
||||
res = abs(res * 2) / 2;
|
||||
return res % 2;
|
||||
}
|
||||
|
|
Reference in a new issue