3 ms·
Parsing Text with Scala
- wooby 17y agoI started on a Lisp interpreter in Scala but only got as far as a prefix notation/sexp parser: http://gist.github.com/215712 http://gist.github.com/215712 You can load it into the REPL with scala -i PNCalc.scala and try an expression with PNCalc.test: scala> PNCalc.test("(+ (/ 3 1) (- 10 5))") Tree: ESum(List(EDiv(List(EValue(3.0), EValue(1.0))), ESubtract(List(EValue(10.0), EValue(5.0))))) Eval: 8.0 The Scala parsing stuff is really nice.