Commit Graph

23 Commits

Author SHA1 Message Date
Randy Heit aaae9f2e05 Store known but uncompiled nodes in the symbol table
- Don't bother keeping track of uncompiled nodes in a special table. Use
  the regular symbol table instead. This should in the future make
  compiling nodes referenced deeper than (and before) their definitions
  fairly straightforward.
- Also, break up the compiler's Message() function into Warn() and Error()
  and get rid of zcc_errors.h. I can't really see having a set of error
  numbers being useful.
2016-03-18 19:34:32 -05:00
Randy Heit 964ff46063 Add new state options to parser and actually enable them
- Added new state options that DECORATE got to the lemon parser.
- Enable token generation for state options. They were previously not
  generated, so the grammar treated them as function calls instead.
2016-03-03 18:33:07 -06:00
Randy Heit 55142078d8 Normalize line endings 2016-03-01 09:47:10 -06:00
Christoph Oelckers 7b6b473ec4 - some GCC fixed by Edward-san. 2015-04-29 11:28:04 +02:00
Randy Heit 3063df4f74 Add single <-> double conversions.
- With explicit casting now possible, converting from double to single
  precision floating point and back again needs to be possible, too.
2013-11-01 21:45:02 -05:00
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 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 33e835b58d Accept name constants in the grammar 2013-09-10 21:56:13 -05:00
Randy Heit b6e525d935 Add missing closing " for string constants in AST dumps 2013-09-10 21:50:27 -05:00
Randy Heit 52d5e74e7e Mark unsigned constants in AST dumps.
- Add the u suffix to unsigned integer constants printed in AST dumps.
2013-09-10 21:48:15 -05:00
Randy Heit 3044fdd0a9 Use %f instead of %g in AST dumps
- To ensure that floating point constants are identifiable as floating
  point, FLispString::AddFloat() now prints them with %f.
2013-09-10 21:24:32 -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 f6bbd5abf7 Simplify AST dumps.
- 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.
2013-07-24 21:35:02 -05:00
Randy Heit 67caf3303b Add the array size to ZCC_VarName 2013-07-23 19:59:47 -05:00
Randy Heit 9cf9226e86 Don't leave open parentheses hanging at line breaks 2013-07-17 23:47:06 -05:00
Randy Heit c733e4229a Added more linebreaks to AST dumps 2013-07-17 23:47:06 -05:00
Randy Heit 726ecaf01b Added basic pretty printing for AST dumps 2013-07-17 23:47:05 -05:00
Randy Heit 6088acd4c0 Add function body to ZCC_FuncDeclarator 2013-07-10 23:26:56 -05:00
Randy Heit 572823046c Add newlines for better readability in AST dump. 2013-07-10 23:26:01 -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