- The binary form of ZCC_OpInfoType::FindBestProto() needs special
handling for conversion from single to double precision floating point
so that it doesn't choose an integer form over a floating point form
when picking the best prototype.
- This information is already stored in the node's NodeType field, so
there's no reason to go do a table lookup for it elsewhere. Must have
been a brain fart when I wrote them in the first place.
- Fixed: PType::FindConversion() gave all but the source type a distance of
0, so it only ever returned just one step of a route that requires more
than one step.
- The global symbol table was never marked by the GC, so anything pointed
only by it was fair game to disappear.
- Don't clear the global symbol table during DECORATE parsing. Junk in
there should be considered constant after initialization.
- 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.
- PType::FindConversion() can find a path to convert one type to another.
This is completely generic and can handle any number of conversion
functions.
- 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.
- This conversion has behavior similar to %g: It automatically behaves like
%f or %e based on the number of output characters. However, unlike %g,
this decision is also based on what will produce the smallest string
without truncating the output. The precision field (the * in %.*f) is
ignored. Converting a double to text with %H and then back to a double
should be lossless.
- Added TypeVoid for statements, which produce no type.
- Added TypeError for expressions whose arguments are incompatible.
- Pointers now derive from PBasicType instead of PInt. Since they have their own register sets in the VM, this seems to make more sense than treating them as integers.
- 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.
- Constants can be strings, but the existing PSymbolConst couldn't handle
them. The old PSymbolConst is now PSymbolConstNumeric, and the new
PSymbolConst is a now a baseclass for it and PSymbolConstString.
- 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.
- A texture defined in TEXTUREx without any patches isn't necessarily an
error, so accept. This also means they shouldn't be used for determining
if a TEXTURE directory belongs to Strife instead of Doom.