Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
mio-19 committed Jan 27, 2025
1 parent 3f76c19 commit 6e0a4e2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions semantic/shared/src/main/scala/chester/eval/Eval.scala
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package chester.eval

import chester.runtime.Value
import chester.syntax.core.*
import chester.syntax.core.spec.spec.{BooleanTermC, TermT}

case class EvalContext()
case class ReduceContext()

case class Eval[Term <: TermT[Term]]() {
type BooleanTerm = BooleanTermC[Term]
def evalNoEffect(code: Term, ctx: EvalContext = EvalContext()): Value = code match {
case b: BooleanTerm => Value(b.value)
case _ => ???
}
trait Reducer {
def reduce(term: Term)(using ReduceContext, Reducer): Term
}

object Reducer {
def reduce(term: Term)(using ctx:ReduceContext, r: Reducer): Term = r.reduce(term)
}

object NaiveReducer extends Reducer {
override def reduce(term: Term)(using ReduceContext, Reducer):Term=term
}

0 comments on commit 6e0a4e2

Please sign in to comment.