4 * Copyright (C) 2015 Alexander Andrejevic <theflash AT sdf DOT lonestar DOT org>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>
19 * SPDX-License-Identifier: AGPL-3.0-or-later
39 %token LEFT_PARENTHESIS
40 %token RIGHT_PARENTHESIS
44 %token <number> NUMBER
45 %token <string> STRING
47 %type <list> element_list statement_list
48 %type <element> element tuple statement
54 toplevel : statement_list
59 statement_list : /* empty */
63 | statement_list comment
65 /* Skip the comment */
68 | statement_list statement
70 list_append(&$1, &$2->link);
74 statement : LEFT_CHEVRON ATOM element_list RIGHT_CHEVRON
76 $$ = create_statement($2, &$3);
79 tuple : LEFT_PARENTHESIS element_list RIGHT_PARENTHESIS
81 $$ = create_tuple(&$2);
84 element_list : /* empty */
88 | element_list comment
90 /* Skip the comment */
93 | element_list element
95 list_append(&$1, &$2->link);
101 $$ = create_atom($1, 0);
105 $$ = create_atom($2, 1);
109 $$ = create_string($1);
113 $$ = create_number($1);
124 comment : SEMICOLON element { /* Ignored */ }
128 int yyerror(const char *str)