Skip to content

sort.stx

pdmosses/sdf/org.metaborg.meta.lang.template/trans/statix/section/sort.stx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module statix/section/sort

imports

  statix/section/grammar
  statix/sort

signature

  constructors
    Sorts : list(DeclSymbol) -> Grammar

  sorts  constructors
    DeclSort    : string -> DeclSymbol
    DeclSortLex : string -> DeclSymbol
    DeclSortVar : string -> DeclSymbol

rules

  grammarOK(s, Sorts(declSymbols)) :- declSymbolsOK(s, declSymbols).

  : scope * DeclSymbol
  declSymbolOK(s, DeclSort(name))    :- declareSort(s, name, CONTEXTFREE()) == _.
  declSymbolOK(s, DeclSortLex(name)) :- declareSort(s, name, LEXICAL()) == _.
  declSymbolOK(s, DeclSortVar(name)) :- declareSort(s, name, VAR()) == _.
  declSymbolsOK maps declSymbolOK(*, list(*))