| Paste number 68694: | Attribute syntax alternatives |
| Pasted by: | |Agent |
| When: | 3 years, 3 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+1H06 |
| Channel: | #dylan |
| Paste contents: |
// Parses a program block. Declarations made in this block are only in scope within this block.
// block ::= constants variables procedures statement
define parser block ()
rule seq(constants, variables, procedures, statement) => tokens;
slot procedure-list = tokens[2];
slot statement-list = tokens[3];
attributes
declared-constants :: <stretchy-vector> = make(<stretchy-vector>);
declared-variables :: <stretchy-vector> = make(<stretchy-vector>);
afterwards (context, tokens)
if (tokens[3].empty?) error("Need at least one statement.") end if;
end parser;
// Parses a program block. Declarations made in this block are only in scope within this block.
// block ::= constants variables procedures statement
define parser block ()
rule seq(constants, variables, procedures, statement) => tokens;
slot procedure-list = tokens[2];
slot statement-list = tokens[3];
attributes
let declared-constants :: <stretchy-vector> = make(<stretchy-vector>);
let declared-variables :: <stretchy-vector> = make(<stretchy-vector>);
afterwards (context, tokens)
if (tokens[3].empty?) error("Need at least one statement.") end if;
end parser;
// Parses a program block. Declarations made in this block are only in scope within this block.
// block ::= constants variables procedures statement
define parser block ()
rule seq(constants, variables, procedures, statement) => tokens;
slot procedure-list = tokens[2];
slot statement-list = tokens[3];
attr declared-constants :: <stretchy-vector> = make(<stretchy-vector>);
attr declared-variables :: <stretchy-vector> = make(<stretchy-vector>);
afterwards (context, tokens)
if (tokens[3].empty?) error("Need at least one statement.") end if;
end parser;
This paste has no annotations.