calculation priority

This commit is contained in:
Mylloon 2022-12-23 06:42:36 +01:00
parent 843ba8b034
commit 35cccd3ad5
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 3 additions and 4 deletions

View file

@ -41,4 +41,3 @@ $ make test
## Problèmes connus
- Pas de parenthèses pour les calculs
- Pas de prioriétés de calculs

View file

@ -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

View file

@ -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;
}