lac : 4e61add73714b376d135d5b900373c4264af903a
1: %include { #include <lac.h> }
2: %include { #include <assert.h> }
3: %include { #include "private.h" }
4: %token_type { lreg_t }
5: %type sexpr { lreg_t }
6: %extra_argument { struct parse_cb *cb }
7:
8: %syntax_error {
9: printf("SYNTAX ERROR!\n");
10: }
11:
12: input ::= sexprlist ENDPARSE.
13: input ::= error.
14:
15: sexprlist ::= sexprlist sexpr(A). { if (cb != NULL) { cb->res = cb->fn(A, cb->opq); } }
16: sexprlist ::= . { /* */ }
17:
18: sexpr(A) ::= atom(B). { A = B; }
19: sexpr(A) ::= QUOTE sexpr(B). { A = cons(sym_quote, cons(B, NIL)); }
20: sexpr(A) ::= QUASI sexpr(B). { A = cons(sym_quasiquote, cons(B, NIL)); }
21: sexpr(A) ::= COMMA_AT sexpr(B). { A = cons(sym_splice, cons(B, NIL)); }
22: sexpr(A) ::= COMMA sexpr(B). { A = cons(sym_unquote, cons(B, NIL)); }
23: sexpr(A) ::= OPAREN sexpr(B) DOT sexpr(C) CPAREN. { A = cons(B,C); }
24: sexpr(A) ::= OPAREN CPAREN. { A = NIL; }
25: sexpr(A) ::= list(B). { A = B; }
26:
27: list(A) ::= OPAREN sexpr(B) listelem(C) CPAREN. { A = cons(B,C); }
28:
29: listelem(A) ::= sexpr(B) listelem(C). { A = cons(B, C); }
30: listelem(A) ::= . { A = NIL; }
31:
32: atom(A) ::= SYMBOL(B). { A = B; }
33: atom(A) ::= STRING(B). { A = B; }
34: atom(A) ::= INTEGER(B). { A = B; }
35: atom(A) ::= NIHIL(B). { A = B; }
Generated by git2html.