Add error/recover, rep->repl with error catching, and add it to scope so you can do it recursively and debug and whatnot. Also make it take in the grammer to repl with, and fix and commit the new_kraken work from earlier
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#lang (with_import "./new_kraken.kp" new_kraken_untyped) new_kraken_start_symbol
|
||||
|
||||
let my_var = 1337
|
||||
(println $"this is string interpolation: $(+ 1 3 4) <- cool right? another $my_var yep even variables")
|
||||
println($"this is string interpolation: ${+(1 3 4)} <- cool right? another $my_var yep even variables")
|
||||
|
||||
obj Point( x y ) {
|
||||
add |self other| { Point((+ self.x other.x) (+ self.y other.y)) }
|
||||
sub |self other| { Point((- self.x other.x) (- self.y other.y)) }
|
||||
add |self other| { Point(+(self.x other.x) +(self.y other.y)) }
|
||||
sub |self other| { Point(-(self.x other.x) -(self.y other.y)) }
|
||||
to_str |self| { str("x: " self.x ", y: " self.y) }
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ fun say_hi(name) {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
let plus_1 = |x| (+ x 1)
|
||||
let plus_1 = |x| { +(x 1) }
|
||||
let a = 1
|
||||
let b = plus_1(a)
|
||||
println("some" b)
|
||||
@@ -32,10 +32,10 @@ fun test() {
|
||||
println("p3:" p3.to_str)
|
||||
println("p4:" p4.to_str)
|
||||
|
||||
println("before + a b" (+ a b))
|
||||
(with_import "./import_test.kp" (println "after + a b" (+ a b)))
|
||||
println("post after + a b" (+ a b))
|
||||
println("before + a b" +(a b))
|
||||
with_import("./import_test.kp" println("after + a b" +(a b)))
|
||||
println("post after + a b" +(a b))
|
||||
with_import "./import_test.kp":
|
||||
println("post new impot after + a b" (+ a b))
|
||||
println("post new impot after + a b" +(a b))
|
||||
}
|
||||
println("Test result is" test())
|
||||
|
||||
Reference in New Issue
Block a user