expr: add 'ident' value to ExprDef union

This distinguishes between an identifier expression and a string
expression in the union.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: add constructors for more expression types

This makes the parser a bit more declarative. But really it might make
error handling easier.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: add constructor for boolean expressions

Also add a 'bool set' to the ExprDef union, instead of using 'ival' as a
bool.

Signed-off-by: Ran Benita <ran234@gmail.com>
parser: remove 'uval' yylval type

We don't care about DoodadType.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: use ExprCreate in more places

Signed-off-by: Ran Benita <ran234@gmail.com>
parser, symbols: drop unnecessary casts

It's casted into ExprDef and then uncasted for no reason.

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: split expression types and allocate them separately

Currently, we have one ExprDef type, which contains a tagged union with
the value of all expression types. Turns out, this union is quite
wasteful memory-wise. Instead, create separate types for all expressions
(e.g ExprBinary, ExprInteger) which embed the common fields
(ExprCommon), and malloc them per their size; ExprDef then becomes a
union of all these types, but is just used as a generic pointer.

[Instead of making ExprDef a union, another option is to use
ExprCommon as the generic pointer type and then do up-castings, like we
do with ParseCommon. But this makes the code much uglier.]

The diff is mostly straightforward mechanical adaptations. It could have
been much smaller with the help of C11 anonymous structs (which were
previously a gnu extension). This will have saved all of the 'op' ->
'expr->op', etc changes. But if we can be a bit more portable for a
little effort, we should.

Before (./test/rulescomp, x86 32 bit, -O2):
==12974==   total heap usage: 145,217 allocs, 145,217 frees, 10,476,238 bytes allocated

After:
==11145==   total heap usage: 145,217 allocs, 145,217 frees, 8,270,358 bytes allocated

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: add wrapper macro for ExprCreate

Signed-off-by: Ran Benita <ran234@gmail.com>
expr: make Expr creation naming and file location consistent

Signed-off-by: Ran Benita <ran234@gmail.com>