1 | %{ |
---|
2 | /**CFile*********************************************************************** |
---|
3 | |
---|
4 | FileName [smt.l] |
---|
5 | |
---|
6 | PackageName [smt] |
---|
7 | |
---|
8 | Synopsis [Lexical analyzer for formula parser. See smt.h for syntax.] |
---|
9 | |
---|
10 | Author [Hyondeuk Kim] |
---|
11 | |
---|
12 | Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado |
---|
13 | |
---|
14 | All rights reserved. |
---|
15 | |
---|
16 | Redistribution and use in source and binary forms, with or without |
---|
17 | modification, are permitted provided that the following conditions |
---|
18 | are met: |
---|
19 | |
---|
20 | Redistributions of source code must retain the above copyright |
---|
21 | notice, this list of conditions and the following disclaimer. |
---|
22 | |
---|
23 | Redistributions in binary form must reproduce the above copyright |
---|
24 | notice, this list of conditions and the following disclaimer in the |
---|
25 | documentation and/or other materials provided with the distribution. |
---|
26 | |
---|
27 | Neither the name of the University of Colorado nor the names of its |
---|
28 | contributors may be used to endorse or promote products derived from |
---|
29 | this software without specific prior written permission. |
---|
30 | |
---|
31 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
32 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
33 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
---|
34 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
---|
35 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
---|
36 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
---|
37 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
---|
38 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
---|
39 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
40 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
---|
41 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
42 | POSSIBILITY OF SUCH DAMAGE.] |
---|
43 | |
---|
44 | ******************************************************************************/ |
---|
45 | |
---|
46 | #ifdef HAVE_LIBGMP |
---|
47 | |
---|
48 | #include "smtRead.h" |
---|
49 | |
---|
50 | /*---------------------------------------------------------------------------*/ |
---|
51 | /* Constant declarations */ |
---|
52 | /*---------------------------------------------------------------------------*/ |
---|
53 | |
---|
54 | /*---------------------------------------------------------------------------*/ |
---|
55 | /* Variable declarations */ |
---|
56 | /*---------------------------------------------------------------------------*/ |
---|
57 | |
---|
58 | |
---|
59 | /**AutomaticStart*************************************************************/ |
---|
60 | |
---|
61 | /*---------------------------------------------------------------------------*/ |
---|
62 | /* Static function prototypes */ |
---|
63 | /*---------------------------------------------------------------------------*/ |
---|
64 | |
---|
65 | |
---|
66 | /**AutomaticEnd***************************************************************/ |
---|
67 | |
---|
68 | |
---|
69 | |
---|
70 | /*---------------------------------------------------------------------------*/ |
---|
71 | /* Definition of internal functions */ |
---|
72 | /*---------------------------------------------------------------------------*/ |
---|
73 | |
---|
74 | /**Function******************************************************************** |
---|
75 | |
---|
76 | Synopsis [Initializes global variables for parsing file.] |
---|
77 | |
---|
78 | SideEffects [] |
---|
79 | |
---|
80 | ******************************************************************************/ |
---|
81 | void |
---|
82 | SmtFileSetup( |
---|
83 | FILE * fp) |
---|
84 | { |
---|
85 | SmtYyin = fp; |
---|
86 | } |
---|
87 | |
---|
88 | /*---------------------------------------------------------------------------*/ |
---|
89 | /* Definition of static functions */ |
---|
90 | /*---------------------------------------------------------------------------*/ |
---|
91 | |
---|
92 | /**Function******************************************************************** |
---|
93 | |
---|
94 | Synopsis [Prints error message and sets global error flag.] |
---|
95 | |
---|
96 | SideEffects [] |
---|
97 | |
---|
98 | ******************************************************************************/ |
---|
99 | static void |
---|
100 | SmtYyerror( |
---|
101 | char * errmsg) |
---|
102 | { |
---|
103 | (void) fprintf(stderr, "%s in with token \"%s\"\n", errmsg, yytext); |
---|
104 | } |
---|
105 | |
---|
106 | %} |
---|
107 | |
---|
108 | /*---------------------------------------------------------------------------*/ |
---|
109 | /* Lexical analyzer rules */ |
---|
110 | /*---------------------------------------------------------------------------*/ |
---|
111 | |
---|
112 | %option noyywrap |
---|
113 | |
---|
114 | /* substitution strings */ |
---|
115 | /* alnum is the same set in alnumsymbol in io.l except [ and ] being |
---|
116 | removed here for the until operator */ |
---|
117 | /* - , =, and ; are intentionally removed |
---|
118 | - is used for -> and <-> |
---|
119 | = is used for foo = bar |
---|
120 | ; is used for delimitters */ |
---|
121 | /* ( and ) are intentionally removed since they are used as parentheses */ |
---|
122 | /* +, *, and ^ have to be used surrounded by spaces |
---|
123 | since they are symbols. ! can be attached immediately w/o spaces though |
---|
124 | since it is not a symbol */ |
---|
125 | /*alnum [A-Za-z0-9\^\?\|\/\$\<\>~@\_#\$%\"\'\.]**/ |
---|
126 | /*num [0-9]+*/ |
---|
127 | %% |
---|
128 | |
---|
129 | [ \t\n\r] ; |
---|
130 | |
---|
131 | "#".* ; |
---|
132 | |
---|
133 | true { return(TRUE_TOK); } |
---|
134 | false { return(FALSE_TOK); } |
---|
135 | ite { return(ITE_TOK); } |
---|
136 | not { return(NOT_TOK); } |
---|
137 | implies { return(IMPLIES_TOK); } |
---|
138 | if_then_else { return(IF_THEN_ELSE_TOK); } |
---|
139 | and { return(AND_TOK); } |
---|
140 | or { return(OR_TOK); } |
---|
141 | xor { return(XOR_TOK); } |
---|
142 | iff { return(IFF_TOK); } |
---|
143 | exists { return(EXISTS_TOK); } |
---|
144 | forall { return(FORALL_TOK); } |
---|
145 | let { return(LET_TOK); } |
---|
146 | flet { return(FLET_TOK); } |
---|
147 | [\"][^\"]*[\"] { return(STRING_TOK); } |
---|
148 | [\{][^\{]*[\}] { return(USER_VAL_TOK); } |
---|
149 | notes { return(NOTES_TOK); } |
---|
150 | sorts { return(SORTS_TOK); } |
---|
151 | funs { return(FUNS_TOK); } |
---|
152 | preds { return(PREDS_TOK); } |
---|
153 | extensions { return(EXTENSIONS_TOK); } |
---|
154 | definition { return(DEFINITION_TOK); } |
---|
155 | axioms { return(AXIOMS_TOK); } |
---|
156 | logic { return(LOGIC_TOK); } |
---|
157 | ":" { return(COLON_TOK); } |
---|
158 | "(" { return(LPAREN_TOK); } |
---|
159 | ")" { return(RPAREN_TOK); } |
---|
160 | sat { return(SAT_TOK); } |
---|
161 | unsat { return(UNSAT_TOK); } |
---|
162 | unknown { return(UNKNOWN_TOK); } |
---|
163 | assumption { return(ASSUMPTION_TOK); } |
---|
164 | formula { return(FORMULA_TOK); } |
---|
165 | status { return(STATUS_TOK); } |
---|
166 | benchmark { return(BENCHMARK_TOK); } |
---|
167 | extrasorts { return(EXTRASORTS_TOK); } |
---|
168 | extrafuns { return(EXTRAFUNS_TOK); } |
---|
169 | extrapreds { return(EXTRAPREDS_TOK); } |
---|
170 | language { return(LANGUAGE_TOK); } |
---|
171 | "=" { return(EQUALS_TOK); } |
---|
172 | distinct { return(DISTINCT_TOK); } |
---|
173 | "$" { return(DOLLAR_TOK); } |
---|
174 | |
---|
175 | |
---|
176 | [\=\<\>\&@#\+\-\*\/%\|~]+ { return(AR_SYMB); } |
---|
177 | [0-9]+ { return(NUMERAL_TOK); } |
---|
178 | [?][a-zA-Z][a-zA-Z\.\_0-9]* { return(VAR_TOK); } |
---|
179 | [a-zA-Z\/][a-zA-Z\.\'\-\+\/\_\\0-9]* { return(SYM_TOK); } |
---|
180 | |
---|
181 | |
---|
182 | %% |
---|
183 | |
---|
184 | #endif |
---|