Commit 8b59a74
authored
feat: AST generation for compiler builtins convDate and isZero (#31)
**Description**
This PR adds AST generation for `convDate` and `isZero`
For convDate
- convDate: is implemented by getting the date: DD-MM-YYYY we have to
convert it to YYYYMMDD
- If we treat each part of the date as an integer
- YYYY * 1000 will give us: YYYY0000
- MM * 100 will give us: MM00
- DD * 1 will give us DD
- Adding up all these values will give us YYYYMMDD
For isZero
- isZero is implmented by after generating the AST for the expression
inside isZero creating a leaf with a 0 value and creating a node with
comparison "==" with the expression as the left_child and the 0 as the
right_child1 parent 1c7b872 commit 8b59a74
2 files changed
+55
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
497 | 504 | | |
498 | 505 | | |
499 | 506 | | |
| |||
514 | 521 | | |
515 | 522 | | |
516 | 523 | | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
517 | 564 | | |
518 | 565 | | |
519 | 566 | | |
| |||
751 | 798 | | |
752 | 799 | | |
753 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
754 | 808 | | |
755 | 809 | | |
756 | 810 | | |
| |||
0 commit comments