JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Sat Aug 05, 2006 10:04 pm Post subject: August 5th |
|
|
More codegen done. Got index/dot expressions working properly, and fixed some temp register allocation issues. The only expression I have left is array constructors, and then it's just foreach, switches, and exception stuff.
There have also been some changes to the table grammar. They are:
- Tables may no longer have "list-style" fields; that is, you can't write:
This is because the list-like functionality used commonly in Lua is in arrays in MiniD instead. It also simplifies the codegen for tables
Because of the above, table fields which have an arbitrary expression as the index are more like Lua, i.e. Code: | { [4] = "hello", [foo() + 3] = 6 } | This is because there is no longer any ambiguity as to what a left bracket means at the beginning of a table field.
Commas after table fields are now required, except after function-style fields, where they are optional.
I'm thinking about how to implement array constructors. See, in Lua, when constructing an "array," it codes the elements to a bunch of consecutive registers, then every n elements (called "fields per flush"), it sets them all in a chunk to the table. I find this kind of inelegant, as it involves increasing the size of the function's local stack to somewhat ridiculous levels, and if there are too many local registers already used, it will fail. Hmm. |
|