Skip to content

Commit 7df89c1

Browse files
committed
cons list
1 parent a19f3bd commit 7df89c1

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

JavaFrontParser/trans/starter.str

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,32 @@ rules
8888
to-kast:
8989
x -> $[# [x](.KList)]
9090
where <is-int> x
91-
91+
92+
93+
// to-kast:
94+
// IdList(b) -> $[ [<to-kast-idlist> b] ]
95+
//
96+
//
97+
// to-kast-idlist:
98+
// [hd | tl] -> $['IdList([<to-kast> hd],,
99+
// [<to-kast-idlist> tl])]
100+
//
101+
// to-kast-idlist:
102+
// [] -> $[.IdList]
103+
104+
92105
to-kast:
93-
a#(b) -> $[[<to-kast-userlist> a#(b)]]
94-
where (!a => "SwitchLabelList")
106+
a#(b) -> $[[<to-kast-userlist> (a,b)]]
107+
where (!a => "IdList")
108+
109+
110+
to-kast-userlist:
111+
(a,[[hd | tl]]) -> $['[a]([<to-kast> hd],,
112+
[<to-kast-userlist> (a, [tl])])]
113+
114+
to-kast-userlist:
115+
(a,[[]]) -> $[.[a]]
116+
//where debug(!"to-kast-user-0: ")
95117

96118
to-kast:
97119
a#(b) -> $['[a](
@@ -103,9 +125,6 @@ rules
103125

104126
to-kast:
105127
a#(b) -> $[[<to-kast-list> b]]
106-
//where debug(!"MyList: ")
107-
//where not(!a => [])
108-
//where debug(!"Term3: ")
109128

110129

111130
to-kast-list:
@@ -122,15 +141,7 @@ rules
122141

123142

124143

125-
to-kast-userlist:
126-
a#([hd | tl]) -> $['[a]([<to-kast> hd],,
127-
[[<to-kast-userlist> a#(tl)]])]
128-
129144

130-
131-
132-
to-kast-userlist:
133-
a#([]) -> $[.[a]]
134145

135146

136147

0 commit comments

Comments
 (0)