Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
mio-19 committed Oct 24, 2024
1 parent f89acee commit 287f7c8
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ import chester.syntax.core._
object Scala {
case class ScalaContext()
def compile(term: core.Term)(implicit ctx: ScalaContext): meta.Tree = term match {
case IntegerTerm(i, _) => Lit.Int(i.toInt)
case _ => throw new NotImplementedError(s"not implemented ${term.getClass.getName} $term")
case IntegerTerm(i, _) => {
require(i.isValidInt)
Lit.Int(i.toInt)
}
case IntTerm(i, _) => Lit.Int(i)
case StringTerm(s, _) => Lit.String(s)
case SymbolTerm(s, _) => Lit.Symbol(Symbol(s))
case _ => throw new NotImplementedError(s"not implemented ${term.getClass.getName} $term")
}

}

0 comments on commit 287f7c8

Please sign in to comment.