1+ ;; IL Subsets
2+
3+ def $with_higher_order : bool
4+ def $with_polymorphic_types : bool
5+ def $with_dependent_types : bool
6+ def $with_family_types : bool
7+ def $with_grammars : bool
8+ def $with_noncomputational : bool ;; semantic restriction
9+
10+
111;; Identifiers
212
313syntax id = text
@@ -23,7 +33,10 @@ syntax typ =
2333 | TUP typbind* ;; (id : typ , ... , id : typ)
2434 | ITER typ iter ;; typ iter
2535 | VAR id arg* ;; typid(arg*)
36+ -- if arg* = eps \/ $with_polymorphic_types \/ $with_dependent_types
2637 | MATCH id arg* WITH inst* ;; `match` typid(arg*) `with` inst*
38+ -- if arg* = eps \/ $with_polymorphic_types \/ $with_dependent_types
39+ -- if |inst*| <= 1 \/ $with_family_types
2740
2841syntax deftyp =
2942 | ALIAS typ
@@ -132,62 +145,65 @@ syntax expfield = atom `= exp
132145syntax exppull = id `: typ `<- exp
133146
134147syntax path =
135- | ROOT ;;
136- | THE path ;; path!
137- | IDX path exp ;; path[ exp ]
138- | SLICE path exp exp ;; path[ exp : exp ]
139- | DOT path atom ;; path.atom
140- | PROJ path mixop ;; path!mixop
148+ | ROOT ;;
149+ | THE path ;; path!
150+ | IDX path exp ;; path[ exp ]
151+ | SLICE path exp exp ;; path[ exp : exp ]
152+ | DOT path atom ;; path.atom
153+ | PROJ path mixop ;; path!mixop
141154
142155
143156;; Grammars
144157
145- syntax sym =
146- | VAR id arg* ;; gramid( arg* )
147- | NUM nat ;; num
148- | TEXT text ;; text
149- | SEQ sym* ;; sym*
150- | ALT sym* ;; sym `|` sym
151- | RANGE sym sym ;; sym `|` `...` `|` sym
152- | ITER sym iter exppull* ;; sym iter{ exppull* }
153- | ATTR exp sym ;; exp `:` sym
158+ syntax sym = ;; only used if $with_grammars
159+ | VAR id arg* ;; gramid( arg* )
160+ -- if arg* = eps \/ $with_polymorphic_types \/ $with_dependent_types
161+ | NUM nat ;; num
162+ | TEXT text ;; text
163+ | SEQ sym* ;; sym*
164+ | ALT sym* ;; sym `|` sym
165+ | RANGE sym sym ;; sym `|` `...` `|` sym
166+ | ITER sym iter exppull* ;; sym iter{ exppull* }
167+ | ATTR exp sym ;; exp `:` sym
154168
155169
156170;; Definitions
157171
158172syntax arg =
159- | TYP typ
173+ | TYP typ -- if $with_polymorphic_types
160174 | EXP exp
161- | FUN id
162- | GRAM sym
175+ | FUN id -- if $with_higher_order
176+ | GRAM sym -- if $with_grammars
163177
164178syntax param =
165- | TYP id
179+ | TYP id -- if $with_polymorphic_types
166180 | EXP id `: typ
167- | FUN id `: param* `-> typ
168- | GRAM id `: param* `-> typ
181+ | FUN id `: param* `-> typ -- if $with_higher_order
182+ | GRAM id `: param* `-> typ -- if $with_grammars
169183
170184syntax quant = param
171185
172186syntax prem =
173- | REL id arg* `: exp
187+ | REL id arg* `: exp -- if $with_noncomputational
174188 | IF exp
175189 | ELSE
176190 | NOT prem
177- | LET exp `= exp ;; TODO: variables/quantifiers?
191+ | LET exp `= exp ;; TODO: variables/quantifiers?
178192 | ITER prem iter exppull*
179193
180194syntax dec =
181- | TYP id param* `= inst*
195+ | TYP id param* `= inst* -- if |inst*| <= 1 \/ $with_family_types
182196 | REL id param* `: typ `= rul*
183197 | FUN id param* `: typ `= clause*
184- | GRAM id param* `: typ `= prod*
198+ | GRAM id param* `: typ `= prod* -- if $with_grammars
185199 | REC dec*
186200
187201syntax inst = INST `{quant*} arg* `=> deftyp
202+ -- if arg* = (TYP typ)* \/ $with_dependent_types
188203syntax rul = RULE `{quant*} exp `- prem*
189204syntax clause = CLAUSE `{quant*} arg* `=> exp `- prem*
190- syntax prod = PROD `{quant*} sym `=> exp `- prem*
205+ syntax prod = PROD `{quant*} sym `=> exp `- prem*
206+ -- if $with_grammars
191207
192208
193209;; Scripts
0 commit comments