JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Mon Jul 31, 2006 3:53 pm Post subject: Update - July 31 |
|
|
I've been working on the codegen (haven't had much time the last couple days - now I'm off tomorrow and wednesday, wee!). I was following the Lua compiler for the codegen, and realized that it was severely optimized and specialized and that it was next to impossible to extricate, duplicate, and expand upon, so I kind of reorganized it in a more sane (and a little easier to follow) manner. Now I've got an "expression stack," so I can push operands onto it, then pop them off in an operation, which will get the operands and code the instruction and whatnot.
One semantic change has been effected in the language spec as a result of the codegen - assignments (for local definitions as well) may only have one expression on the right-hand-side. If there are multiple targets, the RHS must be either a function call or vararg expression. So, the following which are legal in Lua (and used to be in MiniD):
Code: | local a, b, c = 1, 2, 3;
a, b, c = 4, 5, 6; |
Are no longer. Why is this? It (1) simplifies the codegen a bit and (2) it's very rare that you need to do "a, b, c = 1, 2, 3", and that looks confusing too. At least when you write "a, b, c = f()", it's obvious that you're getting multiple results from a function call. |
|