Changes between Version 20 and Version 21 of AST


Ignore:
Timestamp:
04/20/11 10:55:21 (15 years ago)
Author:
zirkel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AST

    v20 v21  
    2121 * What to do about #defines from the system (OSX, etc.)?  Determine these automatically, or take as input?
    2222
     23Comments:
     24 * When multiple translation units are present, an AST is generated for each unit, and then the ASTs are merged (global scope variables are merged to one scope).
     25 * For any global scope variable with the same name that is declared in multiple files, all but at most one must be extern.
     26 * No extern variable declarations can have initializers.
     27 * For scoping issues with blocks, see sec 8.4 of C: A Reference Manual.
     28  * Rewrite blocks to have variables declared separately.  Replace declarations that have initializations with assignment statements.
     29Example:
     30{{{
     31int x=1;
     32{ print x;
     33  int x=2;
     34  print x;
     35}
     36}}}
     37In the AST, translate this to:
     38 * Root
     39  * Globals: x
     40  * Statements
     41   * Block
     42    * Decls
     43     * x
     44      * int
     45    * Stmt
     46     * print x
     47     * x = 2
     48     * print x
    2349== Elements of a TASS AST ==
    2450