Skip to content

Commit

Permalink
Fix signature generation with LAYOUT? in kernel syntax (Statix spec)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gohla committed Oct 8, 2021
1 parent 3579ddd commit d88c75a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion org.metaborg.meta.lang.template/trans/statix/main.str
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ signature constructors // Types
SORT : Occurrence -> TYPE
PROD : list(TYPE) * TYPE -> TYPE
INJ : list(TYPE) * TYPE -> TYPE

ITER : TYPE -> TYPE
TERMINAL : TYPE
LAYOUT : TYPE

SEQ : TYPE * list(TYPE) -> TYPE
OPT : TYPE -> TYPE
ALT : TYPE * TYPE -> TYPE

rules // Types

Expand All @@ -43,7 +48,19 @@ rules // Types

fail-msg(|msg) = err-msg(|$[get-type: [msg]]); fail

remove-unnecessary-types = remove-all(?TERMINAL() + ?LAYOUT())
is-concrete-syntax-type = ?TERMINAL()
is-concrete-syntax-type = ?LAYOUT()
is-concrete-syntax-type: SEQ(t, _) -> <is-concrete-syntax-type> t
is-concrete-syntax-type: SEQ(_, ts) -> <one(is-concrete-syntax-type)> ts
is-concrete-syntax-type: OPT(t) -> <is-concrete-syntax-type> t
is-concrete-syntax-type: ALT(t, _) -> <is-concrete-syntax-type> t
is-concrete-syntax-type: ALT(_, t) -> <is-concrete-syntax-type> t

is-legacy-type = ?SEQ(_, _)
is-legacy-type = ?OPT(_)
is-legacy-type = ?ALT(_, _)

remove-unnecessary-types = remove-all(is-concrete-syntax-type <+ is-legacy-type)

to-compatible-type:
SORT(occ) -> SortType(<stx-get-occurrence-terms; Hd> occ)
Expand Down

0 comments on commit d88c75a

Please sign in to comment.