Commit Graph

4 Commits

Author SHA1 Message Date
dab474a037 Add lists
This introduces:

* new syntax for list literals, put comma-separated values between
  braces for your new list
* new syntax for indexing, do `foo[index]` to get the value in `foo` at
  `index`. Lists also allow negative indices too. Any type that wants to
  be indexed can include their own __index__ function as well.
* new VM instruction, BuildList. List literals were a lot easier to
  implement using this rather than creating a new list, creating a
  temporary stack value, and then duplicating + pushing to that
  temporary value over and over.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-09-30 16:33:58 -07:00
2f84f2c5bb Fix minor format stnank with genast.py
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-09-26 11:09:07 -07:00
ccf6c9e939 Update visitor methods to return a Result<(), Box<dyn Error>>
Visitors for AST members may be fallible now

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-09-20 16:03:37 -07:00
0c3e8bd4c0 Add tools and .gitignore
Mostly going to be changing up how the AST is generated so I want to get
it into git now before I screw too much up.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-09-16 14:07:53 -07:00