Commit graph

20 commits

Author SHA1 Message Date
Randy Heit
39d7fa0605 Allow access to the numeric properties.
- Identifiers can now evaluate to type references.
- The dot operator can now find symbols in type references.
2013-10-29 22:06:14 -05:00
Randy Heit
03c4244fd8 Accept only one identifier for class names. 2013-10-29 22:05:09 -05:00
Randy Heit
850055a766 Add evaluation of constant unary and binary expressions
- 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.
2013-10-25 22:30:24 -05:00
Randy Heit
d0968af9a6 Separate the AST from the parser state. 2013-10-25 22:30:24 -05:00
Randy Heit
af8e0f2ba6 Represent enumerations as constant definitions
- 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.
2013-09-12 22:00:49 -05:00
Randy Heit
d5fa550118 Make ZCC_TreeNode::AppendSibling() work with lists
- Previously, you could only append lone nodes to ZCC_TreeNode lists.
  Now you can append one list to another.
2013-09-12 22:00:49 -05:00
Randy Heit
61666e1515 Consolidate constant expression nodes into a single type
- 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.
2013-09-10 21:10:48 -05:00
Randy Heit
f9f8d1e79b Add a type field for ZCC expressions.
- 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.
2013-09-10 20:50:21 -05:00
Randy Heit
2823ea5de3 Annote AST nodes with source information 2013-08-28 22:59:03 -05:00
Randy Heit
67caf3303b Add the array size to ZCC_VarName 2013-07-23 19:59:47 -05:00
Randy Heit
aadd4e4de6 ZCCParseNode needs to initialize TopNode
- If the parsing is a complete failure, then TopNode won't ever be set to
  anything during the parsing process.
2013-07-23 18:38:57 -05:00
Randy Heit
6088acd4c0 Add function body to ZCC_FuncDeclarator 2013-07-10 23:26:56 -05:00
Randy Heit
2d139f3846 - DoParse() now writes out the parsed AST for the input file to <file>.ast.
Maybe TODO: Find a simple LISP pretty printer that isn't written in LISP so that the output
  isn't all on one big long line.
- zcc-parse.lemon now returns the complete AST through the parse state.
- Fixed crash in PrintEnumNode().

SVN r3773 (scripting)
2012-07-20 02:54:51 +00:00
Randy Heit
bee4c3e760 - Added functions for converting the AST to text. This is not hooked in anywhere yet, since
the parser currently just throws the AST away.

SVN r2969 (scripting)
2010-10-31 04:36:00 +00:00
Randy Heit
4b8900816b - Make the ZCC parser compilable again. Does every rule in the grammar that needs to appear in
the AST do so now? That would sure be nice.

SVN r2715 (scripting)
2010-09-08 04:32:31 +00:00
Randy Heit
12c6ddfbfb - So, progress...
SVN r2707 (scripting)
2010-09-07 04:11:32 +00:00
Randy Heit
081ebbb64b - I have decided to opt for simplicity over C-like-ness and group array sizes with the rest
of the type declaration rather than split it up after the variable name.
- More AST work. At this rate, maybe I'll finally be building a complete AST by the end of the
  month!

SVN r2499 (scripting)
2010-08-10 04:25:52 +00:00
Randy Heit
9d931ed10c - Make AST nodes for states.
SVN r2425 (scripting)
2010-07-11 18:53:41 +00:00
Randy Heit
85d869315b - More AST'ing about.
SVN r2359 (scripting)
2010-06-06 21:04:55 +00:00
Randy Heit
c043627cc1 - Some abstract syntax tree creation stuff. (Plus some tentative type creation stuff that made
me realize I would be better off creating a type-agnostic AST for the entire input instead
  of trying to tentatively create types before they're seen.)

SVN r2354 (scripting)
2010-06-06 04:15:28 +00:00