Skip to content

Commit

Permalink
t/*: Generate kseq and kdot from syntax declarations
Browse files Browse the repository at this point in the history
This fixes missing constructor and functional attributes
  • Loading branch information
nishantjr committed Jul 3, 2019
1 parent f553a22 commit e23bf99
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
6 changes: 4 additions & 2 deletions t/foobar/expected.ekore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ module B-KSEQ
axiom { R } \equals { K { } , R } ( append { } ( kseq { } ( K1 : KItem { } , K2 : K { } ) , K3 : K { } ) , kseq { } ( K1 : KItem { } , append { } ( K2 : K { } , K3 : K { } ) ) ) [ ]
import A-BASIC-K [ ]
symbol append { } ( K { } , K { } ) : K { } [ function { } ( ) ]
symbol dotk { } ( ) : K { } [ functional { } ( ), constructor { } ( ), injective { } ( ) ]
symbol kseq { } ( KItem { } , K { } ) : K { } [ functional { } ( ), constructor { } ( ), injective { } ( ) ]
symbol dotk { } ( ) : K { } [ functional { } ( ) , constructor { } ( ) , injective { } ( ) ]
symbol kseq { } ( KItem { } , K { } ) : K { } [ functional { } ( ) , constructor { } ( ) , injective { } ( ) ]
syntax K ::= ".K" [ functional , constructor , injective , klabel ( dotk ) ]
syntax K ::= KItem "~>" K [ functional , constructor , injective , klabel ( kseq ) ]
endmodule [ ]

module C-INJ
Expand Down
5 changes: 3 additions & 2 deletions t/foobar/foobar.ekore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ endmodule [ ]
module B-KSEQ
import A-BASIC-K []

symbol kseq{}(KItem{}, K{}) : K{} [functional{}(), constructor{}(), injective{}()]
syntax K ::= KItem "~>" K [klabel(kseq)]
syntax K ::= ".K" [klabel(dotk)]

symbol append{}(K{}, K{}) : K{} [function{}()]
symbol dotk{}() : K{} [functional{}(), constructor{}(), injective{}()]

axiom{ R }
\equals{K{},R}(
Expand Down
6 changes: 4 additions & 2 deletions t/imp-simple/expected.ekore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ module B-KSEQ
axiom { R } \equals { K { } , R } ( append { } ( kseq { } ( K1 : KItem { } , K2 : K { } ) , K3 : K { } ) , kseq { } ( K1 : KItem { } , append { } ( K2 : K { } , K3 : K { } ) ) ) [ ]
import A-BASIC-K [ ]
symbol append { } ( K { } , K { } ) : K { } [ function { } ( ) ]
symbol dotk { } ( ) : K { } [ ]
symbol kseq { } ( KItem { } , K { } ) : K { } [ ]
symbol dotk { } ( ) : K { } [ functional { } ( ) , constructor { } ( ) , injective { } ( ) ]
symbol kseq { } ( KItem { } , K { } ) : K { } [ functional { } ( ) , constructor { } ( ) , injective { } ( ) ]
syntax K ::= ".K" [ functional , constructor , injective , klabel ( dotk ) ]
syntax K ::= KItem "~>" K [ functional , constructor , injective , klabel ( kseq ) ]

endmodule [ ]

Expand Down
5 changes: 3 additions & 2 deletions t/imp-simple/imp-simple.ekore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ endmodule [ ]
module B-KSEQ
import A-BASIC-K []

symbol kseq{}(KItem{}, K{}) : K{} []
syntax K ::= KItem "~>" K [klabel(kseq)]
syntax K ::= ".K" [klabel(dotk)]

symbol append{}(K{}, K{}) : K{} [function{}()]
symbol dotk{}() : K{} []

axiom{ R }
\equals{K{},R}(
Expand Down
6 changes: 4 additions & 2 deletions t/peano/expected.ekore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ module B-KSEQ
axiom { R } \equals { K { } , R } ( append { } ( kseq { } ( K1 : KItem { } , K2 : K { } ) , K3 : K { } ) , kseq { } ( K1 : KItem { } , append { } ( K2 : K { } , K3 : K { } ) ) ) [ ]
import A-BASIC-K [ ]
symbol append { } ( K { } , K { } ) : K { } [ function { } ( ) ]
symbol dotk { } ( ) : K { } [ functional { } ( ), constructor { } ( ), injective { } ( ) ]
symbol kseq { } ( KItem { } , K { } ) : K { } [ functional { } ( ), constructor { } ( ), injective { } ( ) ]
symbol dotk { } ( ) : K { } [ functional { } ( ) , constructor { } ( ) , injective { } ( ) ]
symbol kseq { } ( KItem { } , K { } ) : K { } [ functional { } ( ) , constructor { } ( ) , injective { } ( ) ]
syntax K ::= ".K" [ functional , constructor , injective , klabel ( dotk ) ]
syntax K ::= KItem "~>" K [ functional , constructor , injective , klabel ( kseq ) ]
endmodule [ ]

module C-INJ
Expand Down
20 changes: 16 additions & 4 deletions t/peano/peano.ekore
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ endmodule [ ]

module B-KSEQ
import A-BASIC-K []

syntax K ::= KItem "~>" K [klabel(kseq)]
syntax K ::= ".K" [klabel(dotk)]

symbol append{}(K{}, K{}) : K{} [function{}()]
symbol dotk { } ( ) : K { } [ functional { } ( ), constructor { } ( ), injective { } ( ) ]
symbol kseq { } ( KItem { } , K { } ) : K { } [ functional { } ( ), constructor { } ( ), injective { } ( ) ]
axiom { R } \equals { K { }, R } ( append { } ( dotk { } ( ) , K2:K { } ) , K2 : K { } ) [ ]
axiom { R } \equals { K { }, R } ( append { } ( kseq { } ( K1 : KItem { } , K2 : K { } ) , K3 : K { } ) , kseq { } ( K1 : KItem { } , append { } (K2 : K { } , K3 : K { } ) ) ) [ ]

axiom{ R }
\equals{K{},R}(
append{}(dotk{}(),K2:K{}),
K2:K{})
[]

axiom{R}
\equals{K{},R}(
append{}(kseq{}(K1:KItem{},K2:K{}),K3:K{}),
kseq{}(K1:KItem{},append{}(K2:K{},K3:K{})))
[]
endmodule [ ]

module C-INJ
Expand Down

0 comments on commit e23bf99

Please sign in to comment.