diff --git a/src/index.test.ts b/src/index.test.ts index f227f53..f19e464 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -24,12 +24,12 @@ it("execute 1 == 2", () => { expect(execute("1 == 2")).toBe("거짓"); }); -it("execute 2 > 1 == 참", () => { - expect(execute("2 > 1 == 참")).toBe("참"); +it("execute 참 == 2 > 1", () => { + expect(execute("참 == 2 > 1")).toBe("참"); }); -it("execute 1 != 1 == 거짓", () => { // note that comparison is left associative - expect(execute("1 != 1 == 거짓")).toBe("참"); +it("execute 거짓 == 1 != 1", () => { // note that comparison is left associative + expect(execute("거짓 == 1 != 1")).toBe("참"); }); it("execute 거짓 == (1 < 1+1)", () => { diff --git a/src/index.ts b/src/index.ts index 278f9ac..86652f1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,11 +1,11 @@ import Lexer from "./lexer"; -import Parser from "./parser"; -import Evaluator, { Environment } from "./evaluator"; +import Parser from "./parser/v2"; +import Evaluator, { Environment } from "./evaluator/v2"; export const execute = (input: string): string => { const lexer = new Lexer(input); const parser = new Parser(lexer); - const parsed = parser.parseProgram(); + const parsed = parser.parseSource(); const evaluator = new Evaluator(); const environment = new Environment();