Skip to content

Commit

Permalink
add abstract constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Körner committed Jan 7, 2025
1 parent 092bd6a commit bac778c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lisb/translation/ir2ast.clj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
ALetExpressionExpression
ALetPredicatePredicate
AConstantsMachineClause
AAbstractConstantsMachineClause
APropertiesMachineClause
AConstraintsMachineClause
ASetsMachineClause
Expand Down Expand Up @@ -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))))
Expand Down
9 changes: 9 additions & 0 deletions src/lisb/translation/lisb2ir.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bac778c

Please sign in to comment.