- AST nodes cannot be shared, because type conversion changes them in
place, and what's appropriate for one use is by no means appropriate for
all uses.
- Added ZCCCompiler class as a place to generate IR and symbols from an
AST. Right now, all it does is simplify constant expressions into
constant values.
- Do type promotion on the AST where appropriate.
- Added true and false tokens to the parser driver.
- Since the VM doesn't directly support the GT, GTEQ, and NEQ comparisons,
don't use them in the trees either. Instead, wrap them as LTEQ, LT, and
EQEQ inside a BoolNot operator.
- I can't believe I completely forgot to let the parser handle true and
false literals.
- Consolidate all the %include blocks in zcc-parse.lemon into a single
one, because Lemon all of a sudden decided it didn't like me having more
than one in the grammar file.
- Added a PBool type to represent boolean values with.
- Since the tokenizer never gives the parser negative numbers but always a
unary minus followed by a positive number, it seems reasonable to make
the parser smart enough to turn these into negative constants without
generating extra tree nodes.
- And since we're doing it for unary -, we might as well do it for unary +
as well and avoid extra nodes when we know we don't need them.
- For an enum like this:
enum { value1 = SOME_NUM*2, value2 };
Generate an increment expression for value2 of the form
(add (id value1) 1)
and not
(add (* SOME_NUM 2) 1)
- Instead of representating enumeration values with a special node type,
use the same ZCC_ConstantDef nodes that const_def produces. These are
created at the same scope as the ZCC_Enum, rather than being contained
entirely within it. To mark the end of enums for a single instance of
ZCC_Enum, a ZCC_EnumTerminator node is now appended to the chain of
ZCC_ConstantDefs.
- Instead of having ZCC_ExprString, ZCC_ExprInt, and ZCC_ExprFloat,
just use a single ZCC_ExprConstant. It should simplify type
promotion and constant folding in the future.
- Constants can fill out the type field right away. Other expressions will need
to wait until a later pass, after names have been resolved, so they get
initialized to NULL.
- To simplify code generation genericizing, add three new opcodes
* NOP: No-Operation
* LANG: Load Angle - load a BAM angle into a float reg as degrees
* SANG: Save Angle - store a float reg into a BEM angle, converting from degrees
- Added versions of the trig operations supported by FLOP that can work
with degrees directly instead of radians.
- Reorder FLOPs into more sensible groupings.
- More forced line breaks.
- Don't use extra parentheses in places where it can still be unambiguous
without them.
- Don't print the UserType for basic-types that aren't ZCC_UserType.
- Being able to omit optional function arguments is not such a nonsensical
thing after all. However, the previous grammar was still inadequate for
representing this in a useful way.
- Fixed: Trying to define a function without any parameters would silently
discard the function, because the declarator tested FuncParams instead
of FuncName to decide if it was a function.
- Fixed: state_call needs to enclose func_expr_list in LPAREN/RPAREN
itself, because func_expr_list doesn't include them. This means it also
needs a separate production to accept calls without a parameter list.
- The variable_name production now accepts an optional array size
argument. (Not yet passed to the AST.)
- The notation for using dotted ID lists as types has been changed from
[id1.id2] to .id1.id2, beacuse the former conflicts with the notation
for arrays.
- Changed Actor's Damage property into an actual function. All access to the damage property
must now be done through GetMissileDamage. actor->GetMissileDamage(0, 1) is equivalent
to the former actor->Damage, for the case where actor->Damage was not an expression. (I
suppose I will probably need to make a thunk for DECORATE expressions that want to read it.)
- Cleaned up some decorate expression evaluation functions that are no longer used.
SVN r3919 (scripting)