-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |