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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(datatype tree (NT String tree tree)
(T String String))
(function getString (i64) String :no-merge)
(relation Prod (String String String))
(relation End (String String))
(relation P (i64 i64 String))
(function B (i64 i64 String) tree :no-merge)
(rule ((End a s)
(= s (getString pos)))
((P 1 pos a)
(set (B 1 pos a) (T a s))))
(rule ((Prod a b c) ;; a -> bc
(P p1 s b)
(P p2 (+ s p1) c))
((P (+ p1 p2) s a)))
(rule ((Prod a b c)
(= f1 (B p1 s b))
(= f2 (B p2 (+ s p1) c)))
((set (B (+ p1 p2) s a)
(NT a f1 f2))))
(input Prod "./tests/cykjson_Prod.csv")
(input End "./tests/cykjson_End.csv")
; small size 801
(input getString "./tests/cykjson_small_token.csv")
; medium size 7821 but runs for 2 min.
;(input getString "./tests/cykjson_medium_token.csv")
(run 10000)
(let $test1 (B 801 1 "VAL"))
(check (P 801 1 "VAL"))