From bac778cc37db623ea58fd875e76ba9ab016a9792 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20K=C3=B6rner?=
Date: Tue, 7 Jan 2025 13:12:57 +0100
Subject: [PATCH] add abstract constants
---
src/lisb/translation/ir2ast.clj | 5 +++++
src/lisb/translation/lisb2ir.clj | 9 +++++++++
2 files changed, 14 insertions(+)
diff --git a/src/lisb/translation/ir2ast.clj b/src/lisb/translation/ir2ast.clj
index 9259781..e7ed627 100644
--- a/src/lisb/translation/ir2ast.clj
+++ b/src/lisb/translation/ir2ast.clj
@@ -140,6 +140,7 @@
ALetExpressionExpression
ALetPredicatePredicate
AConstantsMachineClause
+ AAbstractConstantsMachineClause
APropertiesMachineClause
AConstraintsMachineClause
ASetsMachineClause
@@ -500,6 +501,10 @@
(s/assert (s/keys :req-un [::values]) ir-node)
(AConstantsMachineClause. (ir-node-values->ast ir-node)))
+(defmethod ir-node->ast-node :abstract-constants [ir-node]
+ (s/assert (s/keys :req-un [::values]) ir-node)
+ (AAbstractConstantsMachineClause. (ir-node-values->ast ir-node)))
+
(defmethod ir-node->ast-node :properties [ir-node]
(s/assert (s/keys :req-un [::values]) ir-node)
(APropertiesMachineClause. (reduce #(AConjunctPredicate. %1 %2) (ir-node-values->ast ir-node))))
diff --git a/src/lisb/translation/lisb2ir.clj b/src/lisb/translation/lisb2ir.clj
index ce2abba..8cfa1d9 100644
--- a/src/lisb/translation/lisb2ir.clj
+++ b/src/lisb/translation/lisb2ir.clj
@@ -235,6 +235,14 @@
:ret (s/and (s/keys :req-un [::tag] :req [::values])
#(= :constants (:tag %))))
+(defn babstract-constants [& ids]
+ {:tag :abstract-constants
+ :values ids})
+(s/fdef babstract-constants
+ :args (s/cat :ids ::ids)
+ :ret (s/and (s/keys :req-un [::tag] :req [::values])
+ #(= :constants (:tag %))))
+
(defn bproperties [& preds]
{:tag :properties
:values preds})
@@ -1699,6 +1707,7 @@
"deferred-set" 'lisb.translation.lisb2ir/bdeferred-set
"enumerated-set" 'lisb.translation.lisb2ir/benumerated-set
"constants" 'lisb.translation.lisb2ir/bconstants
+ "abstract-constants" 'lisb.translation.lisb2ir/babstract-constants
"properties" 'lisb.translation.lisb2ir/bproperties
"definitions" 'lisb.translation.lisb2ir/bdefinitions
"expression-definition" 'lisb.translation.lisb2ir/bexpression-definition