From 950d17b9b822539ca1451c2e3092e7a754993429 Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Thu, 25 Aug 2016 07:21:15 -0700 Subject: [PATCH] "vox" -> "lox" in Java stuff. --- Makefile | 36 +- .../{vox => lox}/AstPrinter.java | 2 +- .../{vox => lox}/Callable.java | 2 +- .../{vox => lox}/Environment.java | 2 +- .../{vox => lox}/ErrorReporter.java | 2 +- .../{vox => lox}/Expr.java | 2 +- .../{vox => lox}/Interpreter.java | 32 +- .../{vox/Vox.java => lox/Lox.java} | 14 +- .../{vox/VoxClass.java => lox/LoxClass.java} | 24 +- .../VoxFunction.java => lox/LoxFunction.java} | 12 +- .../VoxInstance.java => lox/LoxInstance.java} | 10 +- .../{vox => lox}/NativeFunction.java | 2 +- .../{vox => lox}/Parser.java | 4 +- .../{vox => lox}/Resolver.java | 2 +- .../{vox => lox}/Return.java | 2 +- .../{vox => lox}/RuntimeError.java | 2 +- .../{vox => lox}/Scanner.java | 4 +- .../{vox => lox}/Stmt.java | 2 +- .../{vox => lox}/Token.java | 2 +- .../{vox => lox}/TokenType.java | 2 +- .../tool/GenerateAst.java | 4 +- jlox | 2 + jvox | 2 - util/test.py | 468 +++++++++--------- 24 files changed, 318 insertions(+), 318 deletions(-) rename java/com/craftinginterpreters/{vox => lox}/AstPrinter.java (99%) rename java/com/craftinginterpreters/{vox => lox}/Callable.java (85%) rename java/com/craftinginterpreters/{vox => lox}/Environment.java (98%) rename java/com/craftinginterpreters/{vox => lox}/ErrorReporter.java (95%) rename java/com/craftinginterpreters/{vox => lox}/Expr.java (99%) rename java/com/craftinginterpreters/{vox => lox}/Interpreter.java (92%) rename java/com/craftinginterpreters/{vox/Vox.java => lox/Lox.java} (93%) rename java/com/craftinginterpreters/{vox/VoxClass.java => lox/LoxClass.java} (66%) rename java/com/craftinginterpreters/{vox/VoxFunction.java => lox/LoxFunction.java} (81%) rename java/com/craftinginterpreters/{vox/VoxInstance.java => lox/LoxInstance.java} (73%) rename java/com/craftinginterpreters/{vox => lox}/NativeFunction.java (94%) rename java/com/craftinginterpreters/{vox => lox}/Parser.java (99%) rename java/com/craftinginterpreters/{vox => lox}/Resolver.java (99%) rename java/com/craftinginterpreters/{vox => lox}/Return.java (77%) rename java/com/craftinginterpreters/{vox => lox}/RuntimeError.java (83%) rename java/com/craftinginterpreters/{vox => lox}/Scanner.java (98%) rename java/com/craftinginterpreters/{vox => lox}/Stmt.java (98%) rename java/com/craftinginterpreters/{vox => lox}/Token.java (90%) rename java/com/craftinginterpreters/{vox => lox}/TokenType.java (93%) create mode 100755 jlox delete mode 100755 jvox diff --git a/Makefile b/Makefile index 30561fe9..7681f5db 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BUILD_DIR := build -default: cvox jvox +default: cvox jlox debug: @ $(MAKE) -f util/c.make NAME=cvoxd MODE=debug SOURCE_DIR=c @@ -15,7 +15,7 @@ test: test_java test_c test_c: debug @ python util/test.py c -test_java: jvox +test_java: jlox @ python util/test.py java # Remove all build outputs and intermediate files. @@ -32,60 +32,60 @@ cvox: generate_ast: @ $(MAKE) -f util/java.make DIR=java PACKAGE=tool @ java -cp build/java com.craftinginterpreters.tool.GenerateAst \ - java/com/craftinginterpreters/vox + java/com/craftinginterpreters/lox # Compile the Java interpreter .java files to .class files. -jvox: generate_ast - @ $(MAKE) -f util/java.make DIR=java PACKAGE=vox +jlox: generate_ast + @ $(MAKE) -f util/java.make DIR=java PACKAGE=lox run_generate_ast = @ java -cp build/gen/$(1) \ com.craftinginterpreters.tool.GenerateAst \ - gen/$(1)/com/craftinginterpreters/vox + gen/$(1)/com/craftinginterpreters/lox chapters: @ python util/split_chapters.py @ $(MAKE) -f util/java.make DIR=gen/chap03_pancake PACKAGE=pancake - @ $(MAKE) -f util/java.make DIR=gen/chap04_framework PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap04_framework PACKAGE=lox - @ $(MAKE) -f util/java.make DIR=gen/chap05_scanning PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap05_scanning PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap06_representing PACKAGE=tool $(call run_generate_ast,chap06_representing) - @ $(MAKE) -f util/java.make DIR=gen/chap06_representing PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap06_representing PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap07_parsing PACKAGE=tool $(call run_generate_ast,chap07_parsing) - @ $(MAKE) -f util/java.make DIR=gen/chap07_parsing PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap07_parsing PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap08_evaluating PACKAGE=tool $(call run_generate_ast,chap08_evaluating) - @ $(MAKE) -f util/java.make DIR=gen/chap08_evaluating PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap08_evaluating PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap09_statements PACKAGE=tool $(call run_generate_ast,chap09_statements) - @ $(MAKE) -f util/java.make DIR=gen/chap09_statements PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap09_statements PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap10_control PACKAGE=tool $(call run_generate_ast,chap10_control) - @ $(MAKE) -f util/java.make DIR=gen/chap10_control PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap10_control PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap11_functions PACKAGE=tool $(call run_generate_ast,chap11_functions) - @ $(MAKE) -f util/java.make DIR=gen/chap11_functions PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap11_functions PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap12_resolving PACKAGE=tool $(call run_generate_ast,chap12_resolving) - @ $(MAKE) -f util/java.make DIR=gen/chap12_resolving PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap12_resolving PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap13_classes PACKAGE=tool $(call run_generate_ast,chap13_classes) - @ $(MAKE) -f util/java.make DIR=gen/chap13_classes PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap13_classes PACKAGE=lox @ $(MAKE) -f util/java.make DIR=gen/chap14_inheritance PACKAGE=tool $(call run_generate_ast,chap14_inheritance) - @ $(MAKE) -f util/java.make DIR=gen/chap14_inheritance PACKAGE=vox + @ $(MAKE) -f util/java.make DIR=gen/chap14_inheritance PACKAGE=lox # TODO: Unify with make chapters, and make more demand-driven. c_chapters: @@ -144,4 +144,4 @@ diffs: @ -diff --new-file gen/chap31_methods/ gen/chap32_inheritance/ > build/diffs/chap32_inheritance.diff @ -diff --new-file gen/chap32_inheritance/ gen/chap33_native/ > build/diffs/chap33_native.diff -.PHONY: clean cvox debug default diffs jvox test test_c test_java watch +.PHONY: clean cvox debug default diffs jlox test test_c test_java watch diff --git a/java/com/craftinginterpreters/vox/AstPrinter.java b/java/com/craftinginterpreters/lox/AstPrinter.java similarity index 99% rename from java/com/craftinginterpreters/vox/AstPrinter.java rename to java/com/craftinginterpreters/lox/AstPrinter.java index dec0f45b..c20eb16c 100644 --- a/java/com/craftinginterpreters/vox/AstPrinter.java +++ b/java/com/craftinginterpreters/lox/AstPrinter.java @@ -1,5 +1,5 @@ //>= Representing Code -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.Arrays; diff --git a/java/com/craftinginterpreters/vox/Callable.java b/java/com/craftinginterpreters/lox/Callable.java similarity index 85% rename from java/com/craftinginterpreters/vox/Callable.java rename to java/com/craftinginterpreters/lox/Callable.java index e7e26f19..74e78eea 100644 --- a/java/com/craftinginterpreters/vox/Callable.java +++ b/java/com/craftinginterpreters/lox/Callable.java @@ -1,5 +1,5 @@ //>= Functions -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.List; diff --git a/java/com/craftinginterpreters/vox/Environment.java b/java/com/craftinginterpreters/lox/Environment.java similarity index 98% rename from java/com/craftinginterpreters/vox/Environment.java rename to java/com/craftinginterpreters/lox/Environment.java index 89193228..b47926a7 100644 --- a/java/com/craftinginterpreters/vox/Environment.java +++ b/java/com/craftinginterpreters/lox/Environment.java @@ -1,5 +1,5 @@ //>= Statements and State -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.HashMap; import java.util.Map; diff --git a/java/com/craftinginterpreters/vox/ErrorReporter.java b/java/com/craftinginterpreters/lox/ErrorReporter.java similarity index 95% rename from java/com/craftinginterpreters/vox/ErrorReporter.java rename to java/com/craftinginterpreters/lox/ErrorReporter.java index 676b6b9f..847d56b2 100644 --- a/java/com/craftinginterpreters/vox/ErrorReporter.java +++ b/java/com/craftinginterpreters/lox/ErrorReporter.java @@ -1,5 +1,5 @@ //>= Framework -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; class ErrorReporter { boolean hadError = false; diff --git a/java/com/craftinginterpreters/vox/Expr.java b/java/com/craftinginterpreters/lox/Expr.java similarity index 99% rename from java/com/craftinginterpreters/vox/Expr.java rename to java/com/craftinginterpreters/lox/Expr.java index 343adb13..0e817743 100644 --- a/java/com/craftinginterpreters/vox/Expr.java +++ b/java/com/craftinginterpreters/lox/Expr.java @@ -1,4 +1,4 @@ -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.List; diff --git a/java/com/craftinginterpreters/vox/Interpreter.java b/java/com/craftinginterpreters/lox/Interpreter.java similarity index 92% rename from java/com/craftinginterpreters/vox/Interpreter.java rename to java/com/craftinginterpreters/lox/Interpreter.java index 5a60af93..6d886800 100644 --- a/java/com/craftinginterpreters/vox/Interpreter.java +++ b/java/com/craftinginterpreters/lox/Interpreter.java @@ -1,5 +1,5 @@ //>= Evaluating Expressions -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; //>= Functions import java.util.ArrayList; @@ -103,12 +103,12 @@ public Void visitBlockStmt(Stmt.Block stmt) { public Void visitClassStmt(Stmt.Class stmt) { environment.declare(stmt.name); - Map methods = new HashMap<>(); + Map methods = new HashMap<>(); //>= Inheritance Object superclass = null; if (stmt.superclass != null) { superclass = evaluate(stmt.superclass); - if (!(superclass instanceof VoxClass)) { + if (!(superclass instanceof LoxClass)) { throw new RuntimeError(stmt.name, "Superclass must be a class."); } @@ -119,17 +119,17 @@ public Void visitClassStmt(Stmt.Class stmt) { //>= Classes for (Stmt.Function method : stmt.methods) { - VoxFunction function = new VoxFunction(method, environment, + LoxFunction function = new LoxFunction(method, environment, method.name.text.equals("init")); methods.put(method.name.text, function); } /*== Classes - VoxClass klass = new VoxClass(stmt.name.text, methods); + LoxClass klass = new LoxClass(stmt.name.text, methods); */ //>= Inheritance - VoxClass klass = new VoxClass(stmt.name.text, - (VoxClass)superclass, methods); + LoxClass klass = new LoxClass(stmt.name.text, + (LoxClass)superclass, methods); if (superclass != null) { environment = environment.enclosing; @@ -152,10 +152,10 @@ public Void visitExpressionStmt(Stmt.Expression stmt) { public Void visitFunctionStmt(Stmt.Function stmt) { environment.declare(stmt.name); /*>= Functions <= Resolving and Binding - VoxFunction function = new VoxFunction(stmt, environment); + LoxFunction function = new LoxFunction(stmt, environment); */ //>= Classes - VoxFunction function = new VoxFunction(stmt, environment, false); + LoxFunction function = new LoxFunction(stmt, environment, false); //>= Functions environment.assign(stmt.name, function); return null; @@ -314,8 +314,8 @@ public Object visitCallExpr(Expr.Call expr) { @Override public Object visitGetExpr(Expr.Get expr) { Object object = evaluate(expr.object); - if (object instanceof VoxInstance) { - return ((VoxInstance) object).getProperty(expr.name); + if (object instanceof LoxInstance) { + return ((LoxInstance) object).getProperty(expr.name); } throw new RuntimeError(expr.name, @@ -355,8 +355,8 @@ public Object visitSetExpr(Expr.Set expr) { Object value = evaluate(expr.value); Object object = evaluate(expr.object); - if (object instanceof VoxInstance) { - ((VoxInstance)object).fields.put(expr.name.text, value); + if (object instanceof LoxInstance) { + ((LoxInstance)object).fields.put(expr.name.text, value); return value; } @@ -367,10 +367,10 @@ public Object visitSetExpr(Expr.Set expr) { @Override public Object visitSuperExpr(Expr.Super expr) { int distance = locals.get(expr); - VoxClass superclass = (VoxClass)environment.getAt(distance, "super"); - VoxInstance receiver = (VoxInstance)environment.getAt(distance, "this"); + LoxClass superclass = (LoxClass)environment.getAt(distance, "super"); + LoxInstance receiver = (LoxInstance)environment.getAt(distance, "this"); - VoxFunction method = superclass.findMethod(receiver, expr.method.text); + LoxFunction method = superclass.findMethod(receiver, expr.method.text); if (method == null) { throw new RuntimeError(expr.method, "Undefined property '" + expr.method.text + "'."); diff --git a/java/com/craftinginterpreters/vox/Vox.java b/java/com/craftinginterpreters/lox/Lox.java similarity index 93% rename from java/com/craftinginterpreters/vox/Vox.java rename to java/com/craftinginterpreters/lox/Lox.java index 70409858..b407ec91 100644 --- a/java/com/craftinginterpreters/vox/Vox.java +++ b/java/com/craftinginterpreters/lox/Lox.java @@ -1,5 +1,5 @@ //>= Framework -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.io.BufferedReader; import java.io.IOException; @@ -13,13 +13,13 @@ import java.util.Map; //>= Framework -public class Vox { +public class Lox { private final ErrorReporter reporter = new ErrorReporter(); //>= Evaluating Expressions private final Interpreter interpreter; //>= Evaluating Expressions - private Vox() { + private Lox() { interpreter = new Interpreter(reporter); } //>= Framework @@ -48,14 +48,14 @@ private void repl() throws IOException { } public static void main(String[] args) throws IOException { - Vox vox = new Vox(); + Lox lox = new Lox(); if (args.length > 1) { - System.out.println("Usage: jvox [script]"); + System.out.println("Usage: jlox [script]"); } else if (args.length == 1) { - vox.runFile(args[0]); + lox.runFile(args[0]); } else { - vox.repl(); + lox.repl(); } } diff --git a/java/com/craftinginterpreters/vox/VoxClass.java b/java/com/craftinginterpreters/lox/LoxClass.java similarity index 66% rename from java/com/craftinginterpreters/vox/VoxClass.java rename to java/com/craftinginterpreters/lox/LoxClass.java index 6c5aaaf9..9a450bb7 100644 --- a/java/com/craftinginterpreters/vox/VoxClass.java +++ b/java/com/craftinginterpreters/lox/LoxClass.java @@ -1,22 +1,22 @@ //>= Classes -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.List; import java.util.Map; -class VoxClass implements Callable { +class LoxClass implements Callable { final String name; //>= Inheritance - final VoxClass superclass; + final LoxClass superclass; //>= Classes - private final Map methods; + private final Map methods; /*== Classes - VoxClass(String name, Map methods) { + LoxClass(String name, Map methods) { */ //>= Inheritance - VoxClass(String name, VoxClass superclass, - Map methods) { + LoxClass(String name, LoxClass superclass, + Map methods) { //>= Classes this.name = name; //>= Inheritance @@ -25,7 +25,7 @@ class VoxClass implements Callable { this.methods = methods; } - VoxFunction findMethod(VoxInstance instance, String name) { + LoxFunction findMethod(LoxInstance instance, String name) { /*== Classes if (methods.containsKey(name)) { return methods.get(name).bind(instance); @@ -35,7 +35,7 @@ VoxFunction findMethod(VoxInstance instance, String name) { return null; */ //>= Inheritance - VoxClass klass = this; + LoxClass klass = this; while (klass != null) { if (klass.methods.containsKey(name)) { return klass.methods.get(name).bind(instance); @@ -56,16 +56,16 @@ public String toString() { @Override public int requiredArguments() { - VoxFunction initializer = methods.get("init"); + LoxFunction initializer = methods.get("init"); if (initializer == null) return 0; return initializer.requiredArguments(); } @Override public Object call(Interpreter interpreter, List arguments) { - VoxInstance instance = new VoxInstance(this); + LoxInstance instance = new LoxInstance(this); - VoxFunction initializer = methods.get("init"); + LoxFunction initializer = methods.get("init"); if (initializer != null) { initializer.bind(instance).call(interpreter, arguments); } diff --git a/java/com/craftinginterpreters/vox/VoxFunction.java b/java/com/craftinginterpreters/lox/LoxFunction.java similarity index 81% rename from java/com/craftinginterpreters/vox/VoxFunction.java rename to java/com/craftinginterpreters/lox/LoxFunction.java index 8c692483..c721436f 100644 --- a/java/com/craftinginterpreters/vox/VoxFunction.java +++ b/java/com/craftinginterpreters/lox/LoxFunction.java @@ -1,9 +1,9 @@ //>= Functions -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.List; -class VoxFunction implements Callable { +class LoxFunction implements Callable { private final Stmt.Function declaration; private final Environment closure; //>= Classes @@ -11,10 +11,10 @@ class VoxFunction implements Callable { //>= Functions /*>= Functions <= Resolving and Binding -VoxFunction(Stmt.Function declaration, Environment closure) { +LoxFunction(Stmt.Function declaration, Environment closure) { */ //>= Classes - VoxFunction(Stmt.Function declaration, Environment closure, + LoxFunction(Stmt.Function declaration, Environment closure, boolean isInitializer) { //>= Functions this.declaration = declaration; @@ -25,10 +25,10 @@ class VoxFunction implements Callable { } //>= Classes - VoxFunction bind(VoxInstance self) { + LoxFunction bind(LoxInstance self) { Environment environment = closure.enterScope(); environment.define("this", self); - return new VoxFunction(declaration, environment, isInitializer); + return new LoxFunction(declaration, environment, isInitializer); } //>= Functions diff --git a/java/com/craftinginterpreters/vox/VoxInstance.java b/java/com/craftinginterpreters/lox/LoxInstance.java similarity index 73% rename from java/com/craftinginterpreters/vox/VoxInstance.java rename to java/com/craftinginterpreters/lox/LoxInstance.java index 531e4f4c..a85732f2 100644 --- a/java/com/craftinginterpreters/vox/VoxInstance.java +++ b/java/com/craftinginterpreters/lox/LoxInstance.java @@ -1,14 +1,14 @@ //>= Classes -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.HashMap; import java.util.Map; -class VoxInstance { - private VoxClass klass; +class LoxInstance { + private LoxClass klass; final Map fields = new HashMap<>(); - VoxInstance(VoxClass klass) { + LoxInstance(LoxClass klass) { this.klass = klass; } @@ -17,7 +17,7 @@ Object getProperty(Token name) { return fields.get(name.text); } - VoxFunction method = klass.findMethod(this, name.text); + LoxFunction method = klass.findMethod(this, name.text); if (method != null) return method; throw new RuntimeError(name, diff --git a/java/com/craftinginterpreters/vox/NativeFunction.java b/java/com/craftinginterpreters/lox/NativeFunction.java similarity index 94% rename from java/com/craftinginterpreters/vox/NativeFunction.java rename to java/com/craftinginterpreters/lox/NativeFunction.java index b6918659..50134efa 100644 --- a/java/com/craftinginterpreters/vox/NativeFunction.java +++ b/java/com/craftinginterpreters/lox/NativeFunction.java @@ -1,5 +1,5 @@ //>= Reaching the Summit -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.List; diff --git a/java/com/craftinginterpreters/vox/Parser.java b/java/com/craftinginterpreters/lox/Parser.java similarity index 99% rename from java/com/craftinginterpreters/vox/Parser.java rename to java/com/craftinginterpreters/lox/Parser.java index 826a1561..cabf0f9a 100644 --- a/java/com/craftinginterpreters/vox/Parser.java +++ b/java/com/craftinginterpreters/lox/Parser.java @@ -1,5 +1,5 @@ //>= Parsing Expressions -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; //>= Statements and State import java.util.ArrayList; @@ -9,7 +9,7 @@ import java.util.List; import java.util.Set; -import static com.craftinginterpreters.vox.TokenType.*; +import static com.craftinginterpreters.lox.TokenType.*; class Parser { private static final Set synchronizing = new HashSet<>(); diff --git a/java/com/craftinginterpreters/vox/Resolver.java b/java/com/craftinginterpreters/lox/Resolver.java similarity index 99% rename from java/com/craftinginterpreters/vox/Resolver.java rename to java/com/craftinginterpreters/lox/Resolver.java index 3ea25f14..94880603 100644 --- a/java/com/craftinginterpreters/vox/Resolver.java +++ b/java/com/craftinginterpreters/lox/Resolver.java @@ -1,5 +1,5 @@ //>= Resolving and Binding -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.*; diff --git a/java/com/craftinginterpreters/vox/Return.java b/java/com/craftinginterpreters/lox/Return.java similarity index 77% rename from java/com/craftinginterpreters/vox/Return.java rename to java/com/craftinginterpreters/lox/Return.java index f243f612..5b7b0335 100644 --- a/java/com/craftinginterpreters/vox/Return.java +++ b/java/com/craftinginterpreters/lox/Return.java @@ -1,5 +1,5 @@ //>= Functions -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; class Return extends RuntimeException { final Object value; diff --git a/java/com/craftinginterpreters/vox/RuntimeError.java b/java/com/craftinginterpreters/lox/RuntimeError.java similarity index 83% rename from java/com/craftinginterpreters/vox/RuntimeError.java rename to java/com/craftinginterpreters/lox/RuntimeError.java index 5c73bad0..b6b49207 100644 --- a/java/com/craftinginterpreters/vox/RuntimeError.java +++ b/java/com/craftinginterpreters/lox/RuntimeError.java @@ -1,5 +1,5 @@ //>= Evaluating Expressions -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; class RuntimeError extends RuntimeException { final Token token; diff --git a/java/com/craftinginterpreters/vox/Scanner.java b/java/com/craftinginterpreters/lox/Scanner.java similarity index 98% rename from java/com/craftinginterpreters/vox/Scanner.java rename to java/com/craftinginterpreters/lox/Scanner.java index c521c256..fc152c6e 100644 --- a/java/com/craftinginterpreters/vox/Scanner.java +++ b/java/com/craftinginterpreters/lox/Scanner.java @@ -1,12 +1,12 @@ //>= Scanning -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.craftinginterpreters.vox.TokenType.*; +import static com.craftinginterpreters.lox.TokenType.*; class Scanner { private static final Map keywords; diff --git a/java/com/craftinginterpreters/vox/Stmt.java b/java/com/craftinginterpreters/lox/Stmt.java similarity index 98% rename from java/com/craftinginterpreters/vox/Stmt.java rename to java/com/craftinginterpreters/lox/Stmt.java index d2e99692..f4f08a88 100644 --- a/java/com/craftinginterpreters/vox/Stmt.java +++ b/java/com/craftinginterpreters/lox/Stmt.java @@ -1,4 +1,4 @@ -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; import java.util.List; diff --git a/java/com/craftinginterpreters/vox/Token.java b/java/com/craftinginterpreters/lox/Token.java similarity index 90% rename from java/com/craftinginterpreters/vox/Token.java rename to java/com/craftinginterpreters/lox/Token.java index 96aef77d..1e23ecc1 100644 --- a/java/com/craftinginterpreters/vox/Token.java +++ b/java/com/craftinginterpreters/lox/Token.java @@ -1,5 +1,5 @@ //>= Scanning -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; class Token { final TokenType type; diff --git a/java/com/craftinginterpreters/vox/TokenType.java b/java/com/craftinginterpreters/lox/TokenType.java similarity index 93% rename from java/com/craftinginterpreters/vox/TokenType.java rename to java/com/craftinginterpreters/lox/TokenType.java index 2bdb0045..939e5a24 100644 --- a/java/com/craftinginterpreters/vox/TokenType.java +++ b/java/com/craftinginterpreters/lox/TokenType.java @@ -1,5 +1,5 @@ //>= Scanning -package com.craftinginterpreters.vox; +package com.craftinginterpreters.lox; enum TokenType { LEFT_PAREN, RIGHT_PAREN, diff --git a/java/com/craftinginterpreters/tool/GenerateAst.java b/java/com/craftinginterpreters/tool/GenerateAst.java index 4e37ff08..55953601 100644 --- a/java/com/craftinginterpreters/tool/GenerateAst.java +++ b/java/com/craftinginterpreters/tool/GenerateAst.java @@ -7,7 +7,7 @@ import java.util.List; public class GenerateAst { - static String outputDir; + private static String outputDir; public static void main(String[] args) throws IOException { if (args.length != 1) { @@ -77,7 +77,7 @@ private static void defineAstType(String baseName, List types) String path = outputDir + "/" + baseName + ".java"; PrintWriter writer = new PrintWriter(path, "UTF-8"); - writer.println("package com.craftinginterpreters.vox;"); + writer.println("package com.craftinginterpreters.lox;"); writer.println(""); writer.println("import java.util.List;"); writer.println(""); diff --git a/jlox b/jlox new file mode 100755 index 00000000..bc6d5894 --- /dev/null +++ b/jlox @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +java -cp build/java com.craftinginterpreters.lox.Lox $@ diff --git a/jvox b/jvox deleted file mode 100755 index 28a3c329..00000000 --- a/jvox +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -java -cp build/java com.craftinginterpreters.vox.Vox $@ diff --git a/util/test.py b/util/test.py index 7a3e3b13..f8b54cb2 100755 --- a/util/test.py +++ b/util/test.py @@ -41,7 +41,7 @@ def c_interpreter(name, path, tests): def java_interpreter(name, dir, tests): INTERPRETERS[name] = Interpreter(name, - ['java', '-cp', dir, 'com.craftinginterpreters.vox.Vox'], tests) + ['java', '-cp', dir, 'com.craftinginterpreters.lox.Lox'], tests) java_interpreter('java', 'build/java', { 'test': 'pass', @@ -50,14 +50,14 @@ def java_interpreter(name, dir, tests): 'test/scanning': 'skip', 'test/expressions': 'skip', - # No hardcoded limits in jvox. - 'test/limit/loop_too_large.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + # No hardcoded limits in jlox. + 'test/limit/loop_too_large.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', # Rely on JVM for stack overflow checking. - 'test/limit/stack_overflow.vox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', }) java_interpreter('chap05_scanning', 'build/gen/chap05_scanning', { @@ -73,14 +73,14 @@ def java_interpreter(name, dir, tests): # No real interpreter yet. 'test': 'skip', - 'test/expressions/parse.vox': 'pass' + 'test/expressions/parse.lox': 'pass' }) java_interpreter('chap08_evaluating', 'build/gen/chap08_evaluating', { # No real interpreter yet. 'test': 'skip', - 'test/expressions/evaluate.vox': 'pass' + 'test/expressions/evaluate.lox': 'pass' }) java_interpreter('chap09_statements', 'build/gen/chap09_statements', { @@ -90,61 +90,61 @@ def java_interpreter(name, dir, tests): 'test/scanning': 'skip', 'test/expressions': 'skip', - # No hardcoded limits in jvox. - 'test/limit/loop_too_large.vox': 'skip', - 'test/limit/reuse_constants.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + # No hardcoded limits in jlox. + 'test/limit/loop_too_large.lox': 'skip', + 'test/limit/reuse_constants.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', # Rely on JVM for stack overflow checking. - 'test/limit/stack_overflow.vox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', # No control flow. - 'test/block/empty.vox': 'skip', + 'test/block/empty.lox': 'skip', 'test/for': 'skip', 'test/if': 'skip', 'test/logical_operator': 'skip', 'test/while': 'skip', - 'test/variable/unreached_undefined.vox': 'skip', + 'test/variable/unreached_undefined.lox': 'skip', # No functions. 'test/call': 'skip', 'test/closure': 'skip', 'test/function': 'skip', - 'test/operator/not.vox': 'skip', + 'test/operator/not.lox': 'skip', 'test/return': 'skip', - 'test/unexpected_character.vox': 'skip', + 'test/unexpected_character.lox': 'skip', # Broken because we haven't fixed it yet by detecting the error. - 'test/return/at_top_level.vox': 'skip', - 'test/variable/use_local_in_initializer.vox': 'skip', + 'test/return/at_top_level.lox': 'skip', + 'test/variable/use_local_in_initializer.lox': 'skip', # No resolution. - 'test/closure/assign_to_shadowed_later.vox': 'skip', - 'test/function/local_mutual_recursion.vox': 'skip', - 'test/variable/collide_with_parameter.vox': 'skip', - 'test/variable/duplicate_local.vox': 'skip', - 'test/variable/duplicate_parameter.vox': 'skip', - 'test/variable/early_bound.vox': 'skip', + 'test/closure/assign_to_shadowed_later.lox': 'skip', + 'test/function/local_mutual_recursion.lox': 'skip', + 'test/variable/collide_with_parameter.lox': 'skip', + 'test/variable/duplicate_local.lox': 'skip', + 'test/variable/duplicate_parameter.lox': 'skip', + 'test/variable/early_bound.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', - 'test/call/object.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/call/object.lox': 'skip', 'test/class': 'skip', - 'test/closure/close_over_method_parameter.vox': 'skip', + 'test/closure/close_over_method_parameter.lox': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not_class.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not_class.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/return/in_method.vox': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/return/in_method.lox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) java_interpreter('chap10_control', 'build/gen/chap10_control', { @@ -154,60 +154,60 @@ def java_interpreter(name, dir, tests): 'test/scanning': 'skip', 'test/expressions': 'skip', - # No hardcoded limits in jvox. - 'test/limit/loop_too_large.vox': 'skip', - 'test/limit/reuse_constants.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + # No hardcoded limits in jlox. + 'test/limit/loop_too_large.lox': 'skip', + 'test/limit/reuse_constants.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', # Rely on JVM for stack overflow checking. - 'test/limit/stack_overflow.vox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', # No functions. 'test/call': 'skip', 'test/closure': 'skip', - 'test/for/closure_in_body.vox': 'skip', - 'test/for/return_closure.vox': 'skip', - 'test/for/return_inside.vox': 'skip', - 'test/for/syntax.vox': 'skip', + 'test/for/closure_in_body.lox': 'skip', + 'test/for/return_closure.lox': 'skip', + 'test/for/return_inside.lox': 'skip', + 'test/for/syntax.lox': 'skip', 'test/function': 'skip', - 'test/operator/not.vox': 'skip', + 'test/operator/not.lox': 'skip', 'test/return': 'skip', - 'test/unexpected_character.vox': 'skip', - 'test/while/closure_in_body.vox': 'skip', - 'test/while/return_closure.vox': 'skip', - 'test/while/return_inside.vox': 'skip', + 'test/unexpected_character.lox': 'skip', + 'test/while/closure_in_body.lox': 'skip', + 'test/while/return_closure.lox': 'skip', + 'test/while/return_inside.lox': 'skip', # Broken because we haven't fixed it yet by detecting the error. - 'test/return/at_top_level.vox': 'skip', - 'test/variable/use_local_in_initializer.vox': 'skip', + 'test/return/at_top_level.lox': 'skip', + 'test/variable/use_local_in_initializer.lox': 'skip', # No resolution. - 'test/closure/assign_to_shadowed_later.vox': 'skip', - 'test/function/local_mutual_recursion.vox': 'skip', - 'test/variable/collide_with_parameter.vox': 'skip', - 'test/variable/duplicate_local.vox': 'skip', - 'test/variable/duplicate_parameter.vox': 'skip', - 'test/variable/early_bound.vox': 'skip', + 'test/closure/assign_to_shadowed_later.lox': 'skip', + 'test/function/local_mutual_recursion.lox': 'skip', + 'test/variable/collide_with_parameter.lox': 'skip', + 'test/variable/duplicate_local.lox': 'skip', + 'test/variable/duplicate_parameter.lox': 'skip', + 'test/variable/early_bound.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', - 'test/call/object.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/call/object.lox': 'skip', 'test/class': 'skip', - 'test/closure/close_over_method_parameter.vox': 'skip', + 'test/closure/close_over_method_parameter.lox': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not_class.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not_class.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/return/in_method.vox': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/return/in_method.lox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) java_interpreter('chap11_functions', 'build/gen/chap11_functions', { @@ -217,44 +217,44 @@ def java_interpreter(name, dir, tests): 'test/scanning': 'skip', 'test/expressions': 'skip', - # No hardcoded limits in jvox. - 'test/limit/loop_too_large.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + # No hardcoded limits in jlox. + 'test/limit/loop_too_large.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', # Rely on JVM for stack overflow checking. - 'test/limit/stack_overflow.vox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', # Broken because we haven't fixed it yet by detecting the error. - 'test/return/at_top_level.vox': 'skip', - 'test/variable/use_local_in_initializer.vox': 'skip', + 'test/return/at_top_level.lox': 'skip', + 'test/variable/use_local_in_initializer.lox': 'skip', # No resolution. - 'test/closure/assign_to_shadowed_later.vox': 'skip', - 'test/function/local_mutual_recursion.vox': 'skip', - 'test/variable/collide_with_parameter.vox': 'skip', - 'test/variable/duplicate_local.vox': 'skip', - 'test/variable/duplicate_parameter.vox': 'skip', - 'test/variable/early_bound.vox': 'skip', + 'test/closure/assign_to_shadowed_later.lox': 'skip', + 'test/function/local_mutual_recursion.lox': 'skip', + 'test/variable/collide_with_parameter.lox': 'skip', + 'test/variable/duplicate_local.lox': 'skip', + 'test/variable/duplicate_parameter.lox': 'skip', + 'test/variable/early_bound.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', - 'test/call/object.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/call/object.lox': 'skip', 'test/class': 'skip', - 'test/closure/close_over_method_parameter.vox': 'skip', + 'test/closure/close_over_method_parameter.lox': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not_class.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not_class.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/return/in_method.vox': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/return/in_method.lox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) java_interpreter('chap12_resolving', 'build/gen/chap12_resolving', { @@ -264,32 +264,32 @@ def java_interpreter(name, dir, tests): 'test/scanning': 'skip', 'test/expressions': 'skip', - # No hardcoded limits in jvox. - 'test/limit/loop_too_large.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + # No hardcoded limits in jlox. + 'test/limit/loop_too_large.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', # Rely on JVM for stack overflow checking. - 'test/limit/stack_overflow.vox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', - 'test/call/object.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/call/object.lox': 'skip', 'test/class': 'skip', - 'test/closure/close_over_method_parameter.vox': 'skip', + 'test/closure/close_over_method_parameter.lox': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not_class.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not_class.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/return/in_method.vox': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/return/in_method.lox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) java_interpreter('chap13_classes', 'build/gen/chap13_classes', { @@ -299,17 +299,17 @@ def java_interpreter(name, dir, tests): 'test/scanning': 'skip', 'test/expressions': 'skip', - # No hardcoded limits in jvox. - 'test/limit/loop_too_large.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + # No hardcoded limits in jlox. + 'test/limit/loop_too_large.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', # Rely on JVM for stack overflow checking. - 'test/limit/stack_overflow.vox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', # No inheritance. - 'test/class/inherited_method.vox': 'skip', + 'test/class/inherited_method.lox': 'skip', 'test/inheritance': 'skip', 'test/super': 'skip', }) @@ -321,14 +321,14 @@ def java_interpreter(name, dir, tests): 'test/scanning': 'skip', 'test/expressions': 'skip', - # No hardcoded limits in jvox. - 'test/limit/loop_too_large.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + # No hardcoded limits in jlox. + 'test/limit/loop_too_large.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', # Rely on JVM for stack overflow checking. - 'test/limit/stack_overflow.vox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', }) c_interpreter('c', 'build/cvoxd', { @@ -349,51 +349,51 @@ def java_interpreter(name, dir, tests): 'test/expressions': 'skip', # No control flow. - 'test/block/empty.vox': 'skip', + 'test/block/empty.lox': 'skip', 'test/for': 'skip', 'test/if': 'skip', - 'test/limit/loop_too_large.vox': 'skip', + 'test/limit/loop_too_large.lox': 'skip', 'test/logical_operator': 'skip', - 'test/variable/unreached_undefined.vox': 'skip', + 'test/variable/unreached_undefined.lox': 'skip', 'test/while': 'skip', # No local variables. - 'test/block/scope.vox': 'skip', - 'test/variable/duplicate_local.vox': 'skip', - 'test/variable/shadow_global.vox': 'skip', - 'test/variable/shadow_local.vox': 'skip', - 'test/variable/use_local_in_initializer.vox': 'skip', + 'test/block/scope.lox': 'skip', + 'test/variable/duplicate_local.lox': 'skip', + 'test/variable/shadow_global.lox': 'skip', + 'test/variable/shadow_local.lox': 'skip', + 'test/variable/use_local_in_initializer.lox': 'skip', # No functions. 'test/call': 'skip', 'test/closure': 'skip', 'test/function': 'skip', - 'test/limit/reuse_constants.vox': 'skip', - 'test/limit/stack_overflow.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + 'test/limit/reuse_constants.lox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', 'test/return': 'skip', - 'test/unexpected_character.vox': 'skip', - 'test/variable/collide_with_parameter.vox': 'skip', - 'test/variable/duplicate_parameter.vox': 'skip', - 'test/variable/early_bound.vox': 'skip', + 'test/unexpected_character.lox': 'skip', + 'test/variable/collide_with_parameter.lox': 'skip', + 'test/variable/duplicate_parameter.lox': 'skip', + 'test/variable/early_bound.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', 'test/class': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not.vox': 'skip', - 'test/operator/not_class.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not.lox': 'skip', + 'test/operator/not_class.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) c_interpreter('chap25_local', 'build/chap25_local', { @@ -404,44 +404,44 @@ def java_interpreter(name, dir, tests): 'test/expressions': 'skip', # No control flow. - 'test/block/empty.vox': 'skip', + 'test/block/empty.lox': 'skip', 'test/for': 'skip', 'test/if': 'skip', - 'test/limit/loop_too_large.vox': 'skip', + 'test/limit/loop_too_large.lox': 'skip', 'test/logical_operator': 'skip', - 'test/variable/unreached_undefined.vox': 'skip', + 'test/variable/unreached_undefined.lox': 'skip', 'test/while': 'skip', # No functions. 'test/call': 'skip', 'test/closure': 'skip', 'test/function': 'skip', - 'test/limit/reuse_constants.vox': 'skip', - 'test/limit/stack_overflow.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + 'test/limit/reuse_constants.lox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', 'test/return': 'skip', - 'test/unexpected_character.vox': 'skip', - 'test/variable/collide_with_parameter.vox': 'skip', - 'test/variable/duplicate_parameter.vox': 'skip', - 'test/variable/early_bound.vox': 'skip', + 'test/unexpected_character.lox': 'skip', + 'test/variable/collide_with_parameter.lox': 'skip', + 'test/variable/duplicate_parameter.lox': 'skip', + 'test/variable/early_bound.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', 'test/class': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not.vox': 'skip', - 'test/operator/not_class.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not.lox': 'skip', + 'test/operator/not_class.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) c_interpreter('chap26_jumping', 'build/chap26_jumping', { @@ -454,40 +454,40 @@ def java_interpreter(name, dir, tests): # No functions. 'test/call': 'skip', 'test/closure': 'skip', - 'test/for/closure_in_body.vox': 'skip', - 'test/for/return_closure.vox': 'skip', - 'test/for/return_inside.vox': 'skip', - 'test/for/syntax.vox': 'skip', + 'test/for/closure_in_body.lox': 'skip', + 'test/for/return_closure.lox': 'skip', + 'test/for/return_inside.lox': 'skip', + 'test/for/syntax.lox': 'skip', 'test/function': 'skip', - 'test/limit/reuse_constants.vox': 'skip', - 'test/limit/stack_overflow.vox': 'skip', - 'test/limit/too_many_constants.vox': 'skip', - 'test/limit/too_many_locals.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', + 'test/limit/reuse_constants.lox': 'skip', + 'test/limit/stack_overflow.lox': 'skip', + 'test/limit/too_many_constants.lox': 'skip', + 'test/limit/too_many_locals.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', 'test/return': 'skip', - 'test/unexpected_character.vox': 'skip', - 'test/variable/collide_with_parameter.vox': 'skip', - 'test/variable/duplicate_parameter.vox': 'skip', - 'test/variable/early_bound.vox': 'skip', - 'test/while/closure_in_body.vox': 'skip', - 'test/while/return_closure.vox': 'skip', - 'test/while/return_inside.vox': 'skip', + 'test/unexpected_character.lox': 'skip', + 'test/variable/collide_with_parameter.lox': 'skip', + 'test/variable/duplicate_parameter.lox': 'skip', + 'test/variable/early_bound.lox': 'skip', + 'test/while/closure_in_body.lox': 'skip', + 'test/while/return_closure.lox': 'skip', + 'test/while/return_inside.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', 'test/class': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not.vox': 'skip', - 'test/operator/not_class.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not.lox': 'skip', + 'test/operator/not_class.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) c_interpreter('chap27_functions', 'build/chap27_functions', { @@ -499,30 +499,30 @@ def java_interpreter(name, dir, tests): # No closures. 'test/closure': 'skip', - 'test/for/closure_in_body.vox': 'skip', - 'test/for/return_closure.vox': 'skip', - 'test/function/local_recursion.vox': 'skip', - 'test/limit/too_many_upvalues.vox': 'skip', - 'test/while/closure_in_body.vox': 'skip', - 'test/while/return_closure.vox': 'skip', + 'test/for/closure_in_body.lox': 'skip', + 'test/for/return_closure.lox': 'skip', + 'test/function/local_recursion.lox': 'skip', + 'test/limit/too_many_upvalues.lox': 'skip', + 'test/while/closure_in_body.lox': 'skip', + 'test/while/return_closure.lox': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', - 'test/call/object.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/call/object.lox': 'skip', 'test/class': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not.vox': 'skip', - 'test/operator/not_class.vox': 'skip', - 'test/return/in_method.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not.lox': 'skip', + 'test/operator/not_class.lox': 'skip', + 'test/return/in_method.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) c_interpreter('chap28_closures', 'build/chap28_closures', { @@ -533,23 +533,23 @@ def java_interpreter(name, dir, tests): 'test/expressions': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', - 'test/call/object.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/call/object.lox': 'skip', 'test/class': 'skip', - 'test/closure/close_over_method_parameter.vox': 'skip', + 'test/closure/close_over_method_parameter.lox': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not.vox': 'skip', - 'test/operator/not_class.vox': 'skip', - 'test/return/in_method.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not.lox': 'skip', + 'test/operator/not_class.lox': 'skip', + 'test/return/in_method.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) c_interpreter('chap29_garbage', 'build/chap29_garbage', { @@ -560,23 +560,23 @@ def java_interpreter(name, dir, tests): 'test/expressions': 'skip', # No classes. - 'test/assignment/to_this.vox': 'skip', - 'test/call/object.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/call/object.lox': 'skip', 'test/class': 'skip', - 'test/closure/close_over_method_parameter.vox': 'skip', + 'test/closure/close_over_method_parameter.lox': 'skip', 'test/constructor': 'skip', 'test/field': 'skip', 'test/inheritance': 'skip', 'test/method': 'skip', - 'test/number/decimal_point_at_eof.vox': 'skip', - 'test/number/trailing_dot.vox': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/operator/not.vox': 'skip', - 'test/operator/not_class.vox': 'skip', - 'test/return/in_method.vox': 'skip', + 'test/number/decimal_point_at_eof.lox': 'skip', + 'test/number/trailing_dot.lox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/operator/not.lox': 'skip', + 'test/operator/not_class.lox': 'skip', + 'test/return/in_method.lox': 'skip', 'test/super': 'skip', 'test/this': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) c_interpreter('chap30_classes', 'build/chap30_classes', { @@ -587,23 +587,23 @@ def java_interpreter(name, dir, tests): 'test/expressions': 'skip', # No inheritance. - 'test/class/inherited_method.vox': 'skip', + 'test/class/inherited_method.lox': 'skip', 'test/inheritance': 'skip', 'test/super': 'skip', # No methods. - 'test/assignment/to_this.vox': 'skip', - 'test/class/local_reference_self.vox': 'skip', - 'test/class/reference_self.vox': 'skip', - 'test/closure/close_over_method_parameter.vox': 'skip', + 'test/assignment/to_this.lox': 'skip', + 'test/class/local_reference_self.lox': 'skip', + 'test/class/reference_self.lox': 'skip', + 'test/closure/close_over_method_parameter.lox': 'skip', 'test/constructor': 'skip', - 'test/field/method.vox': 'skip', - 'test/field/method_binds_this.vox': 'skip', + 'test/field/method.lox': 'skip', + 'test/field/method_binds_this.lox': 'skip', 'test/method': 'skip', - 'test/operator/equals_class.vox': 'skip', - 'test/return/in_method.vox': 'skip', + 'test/operator/equals_class.lox': 'skip', + 'test/return/in_method.lox': 'skip', 'test/this': 'skip', - 'test/variable/local_from_method.vox': 'skip', + 'test/variable/local_from_method.lox': 'skip', }) c_interpreter('chap31_methods', 'build/chap31_methods', { @@ -614,7 +614,7 @@ def java_interpreter(name, dir, tests): 'test/expressions': 'skip', # No inheritance. - 'test/class/inherited_method.vox': 'skip', + 'test/class/inherited_method.lox': 'skip', 'test/inheritance': 'skip', 'test/super': 'skip', }) @@ -902,7 +902,7 @@ def run_script(path): global failed global num_skipped - if (splitext(path)[1] != '.vox'): + if (splitext(path)[1] != '.lox'): return # Check if we are just running a subset of the tests.