- To make AST:
./cari -i example.cari -ast
start
├─ *
│ ├─ +
│ │ ├─ *
│ │ │ ├─ -25
│ │ │ └─ 10
│ │ └─ *
│ │ ├─ -1
│ │ └─ -7
│ └─ -100
├─ -
│ ├─ 10
│ └─ 7
└─ +
├─ /
│ ├─ -
│ │ ├─ +
│ │ │ ├─ 512
│ │ │ └─ 421
│ │ └─ +
│ │ ├─ 3321
│ │ └─ 70
│ └─ -
│ ├─ 900
│ └─ +
│ ├─ 30
│ └─ 78
└─ -
├─ +
│ ├─ 32
│ └─ 7
└─ 90
- To compile to the assembler code:
./cari -i example.cari -o example.s
- Now you can build your program:
as example.s -o example.o
ld example.o -o example
- Run the program.
./example
24300
3
-54
From cmd folder:
go build -o cari main.go
The minimum number: -9223372036854775808
The maximum number: 9223372036854775807