diff --git a/pkg/hir/parser.go b/pkg/hir/parser.go index 9d5329c..076985f 100644 --- a/pkg/hir/parser.go +++ b/pkg/hir/parser.go @@ -98,7 +98,7 @@ func (p *hirParser) parseDeclaration(s sexp.SExp) error { return p.parseAssertionDeclaration(e.Elements) } else if e.Len() == 3 && e.MatchSymbols(1, "permute") { return p.parseSortedPermutationDeclaration(e) - } else if e.Len() == 4 && e.MatchSymbols(1, "lookup") { + } else if e.Len() == 4 && e.MatchSymbols(1, "deflookup") { return p.parseLookupDeclaration(e) } else if e.Len() == 3 && e.MatchSymbols(1, "interleave") { return p.parseInterleavingDeclaration(e) diff --git a/pkg/schema/constraint/lookup.go b/pkg/schema/constraint/lookup.go index 7f168e7..84c72be 100644 --- a/pkg/schema/constraint/lookup.go +++ b/pkg/schema/constraint/lookup.go @@ -155,5 +155,10 @@ func (p *LookupConstraint[E]) Lisp(schema sc.Schema) sexp.SExp { targets.Append(p.targets[i].Lisp(schema)) } // Done - return sexp.NewList([]sexp.SExp{sexp.NewSymbol(p.handle)}) + return sexp.NewList([]sexp.SExp{ + sexp.NewSymbol("deflookup"), + sexp.NewSymbol(p.handle), + targets, + sources, + }) } diff --git a/testdata/bin-dynamic.lisp b/testdata/bin-dynamic.lisp index ca22bb8..9476b61 100644 --- a/testdata/bin-dynamic.lisp +++ b/testdata/bin-dynamic.lisp @@ -65,7 +65,7 @@ (defconstraint bin:is-byte-result () (ifnot bin:IS_BYTE (if bin:CT_MAX (begin bin:RESULT_HI bin:RESULT_LO) (begin bin:RESULT_HI (- bin:RESULT_LO (* bin:SMALL bin:PIVOT)))))) -(defconstraint bin:result-via-lookup () (ifnot (+ bin:IS_AND bin:IS_OR bin:IS_XOR bin:IS_NOT) (begin (- bin:BYTE_5 bin:XXX_BYTE_HI) (- bin:BYTE_6 bin:XXX_BYTE_LO)))) +(defconstraint bin:result-via-deflookup () (ifnot (+ bin:IS_AND bin:IS_OR bin:IS_XOR bin:IS_NOT) (begin (- bin:BYTE_5 bin:XXX_BYTE_HI) (- bin:BYTE_6 bin:XXX_BYTE_LO)))) (defconstraint bin:isnot-ctmax () (if (- bin:IS_NOT 1) (- bin:CT_MAX 15))) diff --git a/testdata/bin-static.lisp b/testdata/bin-static.lisp index 08b42a4..343f785 100644 --- a/testdata/bin-static.lisp +++ b/testdata/bin-static.lisp @@ -68,7 +68,7 @@ (defconstraint bin:set-oli-mli () (if (+ bin:IS_BYTE bin:IS_SIGNEXTEND) bin:ONE_LINE_INSTRUCTION (if bin:ARGUMENT_1_HI bin:ONE_LINE_INSTRUCTION (- bin:ONE_LINE_INSTRUCTION 1)))) -(defconstraint bin:result-via-lookup () (ifnot (+ bin:IS_AND bin:IS_OR bin:IS_XOR bin:IS_NOT) (begin (- bin:BYTE_5 bin:XXX_BYTE_HI) (- bin:BYTE_6 bin:XXX_BYTE_LO)))) +(defconstraint bin:result-via-deflookup () (ifnot (+ bin:IS_AND bin:IS_OR bin:IS_XOR bin:IS_NOT) (begin (- bin:BYTE_5 bin:XXX_BYTE_HI) (- bin:BYTE_6 bin:XXX_BYTE_LO)))) (defconstraint bin:oli-incrementation () (ifnot bin:ONE_LINE_INSTRUCTION (- (shift bin:STAMP 1) (+ bin:STAMP 1)))) diff --git a/testdata/interleave_04.lisp b/testdata/interleave_04.lisp index 7eaa9f8..2e5e022 100644 --- a/testdata/interleave_04.lisp +++ b/testdata/interleave_04.lisp @@ -1,3 +1,3 @@ (defcolumns X Y Z) (interleave A (X Y)) -(lookup l1 (A) (Z)) +(deflookup l1 (A) (Z)) diff --git a/testdata/lookup_01.lisp b/testdata/lookup_01.lisp index d28dde5..f6f27ee 100644 --- a/testdata/lookup_01.lisp +++ b/testdata/lookup_01.lisp @@ -1,2 +1,2 @@ (defcolumns X Y) -(lookup test (Y) (X)) +(deflookup test (Y) (X)) diff --git a/testdata/lookup_02.lisp b/testdata/lookup_02.lisp index ec0fcb3..5e16fe6 100644 --- a/testdata/lookup_02.lisp +++ b/testdata/lookup_02.lisp @@ -1,3 +1,3 @@ (defcolumns A B X Y) ;; Inclusion A,B into X,Y -(lookup test (X Y) (A B)) +(deflookup test (X Y) (A B)) diff --git a/testdata/lookup_03.lisp b/testdata/lookup_03.lisp index 9ccf5d2..c977473 100644 --- a/testdata/lookup_03.lisp +++ b/testdata/lookup_03.lisp @@ -1,2 +1,2 @@ (defcolumns X Y) -(lookup test (Y) ((* X 2))) +(deflookup test (Y) ((* X 2))) diff --git a/testdata/lookup_04.lisp b/testdata/lookup_04.lisp index c1f7e7f..fbdbd9d 100644 --- a/testdata/lookup_04.lisp +++ b/testdata/lookup_04.lisp @@ -1,2 +1,2 @@ (defcolumns ST X Y) -(lookup test (Y) ((* ST (+ 1 X)))) +(deflookup test (Y) ((* ST (+ 1 X)))) diff --git a/testdata/lookup_05.lisp b/testdata/lookup_05.lisp index 266c9f4..cc90bf0 100644 --- a/testdata/lookup_05.lisp +++ b/testdata/lookup_05.lisp @@ -1,2 +1,2 @@ (defcolumns A B X Y) -(lookup test (X Y) (A (* B 3))) +(deflookup test (X Y) (A (* B 3))) diff --git a/testdata/lookup_06.lisp b/testdata/lookup_06.lisp index d36d5b7..069630f 100644 --- a/testdata/lookup_06.lisp +++ b/testdata/lookup_06.lisp @@ -4,4 +4,4 @@ (module m2) (defcolumns Y) ;; -(lookup test (Y) (m1.X)) +(deflookup test (Y) (m1.X)) diff --git a/testdata/lookup_07.lisp b/testdata/lookup_07.lisp index 3aae5bf..8283fed 100644 --- a/testdata/lookup_07.lisp +++ b/testdata/lookup_07.lisp @@ -1,2 +1,2 @@ (defcolumns A B X) -(lookup test (A B) (X 0)) +(deflookup test (A B) (X 0)) diff --git a/testdata/lookup_08.lisp b/testdata/lookup_08.lisp index a32c654..2b57fbb 100644 --- a/testdata/lookup_08.lisp +++ b/testdata/lookup_08.lisp @@ -1,2 +1,2 @@ (defcolumns A B X) -(lookup test (A B) (0 X)) +(deflookup test (A B) (0 X))