mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
added lox test files
This commit is contained in:
parent
821f5c62bc
commit
0f3d0a15f0
268 changed files with 7497 additions and 3 deletions
32
lox.t/precedence.lox
Normal file
32
lox.t/precedence.lox
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// * has higher precedence than +.
|
||||
print 2 + 3 * 4; // expect: 14
|
||||
|
||||
// * has higher precedence than -.
|
||||
print 20 - 3 * 4; // expect: 8
|
||||
|
||||
// / has higher precedence than +.
|
||||
print 2 + 6 / 3; // expect: 4
|
||||
|
||||
// / has higher precedence than -.
|
||||
print 2 - 6 / 3; // expect: 0
|
||||
|
||||
// < has higher precedence than ==.
|
||||
print false == 2 < 1; // expect: true
|
||||
|
||||
// > has higher precedence than ==.
|
||||
print false == 1 > 2; // expect: true
|
||||
|
||||
// <= has higher precedence than ==.
|
||||
print false == 2 <= 1; // expect: true
|
||||
|
||||
// >= has higher precedence than ==.
|
||||
print false == 1 >= 2; // expect: true
|
||||
|
||||
// 1 - 1 is not space-sensitive.
|
||||
print 1 - 1; // expect: 0
|
||||
print 1 -1; // expect: 0
|
||||
print 1- 1; // expect: 0
|
||||
print 1-1; // expect: 0
|
||||
|
||||
// Using () for grouping.
|
||||
print (2 * (6 - (2 + 2))); // expect: 4
|
||||
Loading…
Add table
Add a link
Reference in a new issue