UNPKG

1.62 kBJavaScriptView Raw
1"use strict";
2/**
3 * C1 AST
4 *
5 * Aims to mostly-faithfully capture the the C1 Grammar as described in
6 * http://c0.typesafety.net/doc/c0-reference.pdf
7 *
8 * Exceptions:
9 * - Does not distinguish <sid>, <vid>, <fid>, and <aid> categories. These are used by the parser to
10 * disambiguate syntactic forms (especially the unfortunate <aid> vs. <tid> distinction needed to parse the
11 * statement `x * y;` as a binary expression or variable declaration). Within a full syntax tree
12 * they are unambiguous and can all be represented with Identifier.
13 * - The restrictions that a variable declaration not appear in the update of a ForStatement is expressed
14 * (this is a property of static semantics in the spec, see C0.23, "The step statement in a for loop may
15 * not be a declaration".).
16 * - SimpleStatement does not include variable declarations, which facilitates the above exception.
17 * - The placement restrictions on requires, ensures, loop_invariant, and assert contracts are
18 * expressed. These are properties of static semantics in the spec, see C0.23, "@requires and @ensures can
19 * only annotate functions," etc.
20 * - Arbitrary pragmas are accepted (this matches the actual behavior of the C0 compiler, which only warns on
21 * unknown pragmas)
22 *
23 * Loosely based on Esprima, with the notable and stubborn distinction of using "tag" instead of "type."
24 * Esprima Spec: https://esprima.readthedocs.io/en/latest/syntax-tree-format.html
25 * Esprima Demo: http://esprima.org/demo/parse.html
26 */
27Object.defineProperty(exports, "__esModule", { value: true });
28//# sourceMappingURL=ast.js.map
\No newline at end of file