Rename the language from Dino to Rex
Files use .rex, the command is rex, and the crate, runtime prefixes, docs, editor files and examples all use the new name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f44f09b6a
commit
7cf9727bcd
94 files changed
+858
-858
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import parser
|
||||
import eval
|
||||
import os
|
||||
|
||||
// Evaluates one line and prints the answer or the problem.
|
||||
func run_line(scope: shared eval.Scope, line: string) {
|
||||
var text = line.trim()
|
||||
if text == "" { return }
|
||||
var tree, err = parser.parse(text)
|
||||
if err != nil {
|
||||
print(" error:", err)
|
||||
return
|
||||
}
|
||||
var value, err2 = scope.eval(tree)
|
||||
if err2 != nil {
|
||||
print(" error:", err2)
|
||||
return
|
||||
}
|
||||
print(" =", value)
|
||||
}
|
||||
|
||||
// Reads lines from the file named on the command line, or from the keyboard.
|
||||
func main() {
|
||||
var scope = shared eval.new_scope()
|
||||
var args = os.args
|
||||
if args.len() > 1 {
|
||||
var text, err = os.read_file(args[1])
|
||||
if err != nil {
|
||||
print("cannot read", args[1], err)
|
||||
os.exit(1)
|
||||
}
|
||||
for line in text.lines() {
|
||||
print(line)
|
||||
run_line(scope, line)
|
||||
}
|
||||
return
|
||||
}
|
||||
for {
|
||||
var line = os.read_line()
|
||||
if line == nil { break }
|
||||
run_line(scope, line)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user