From aa3692a141f9011af538d0c1b21708aed7180389 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Sun, 3 Apr 2022 22:20:31 -0400 Subject: [PATCH] Get rid of core shadow warnings. --- hello.ld | 2 +- src/ludus/core.clj | 4 ++-- src/ludus/interpreter.clj | 4 ++-- src/ludus/parser.clj | 10 +++++----- src/ludus/prelude.clj | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hello.ld b/hello.ld index 0273a1b..570fec5 100644 --- a/hello.ld +++ b/hello.ld @@ -1 +1 @@ -print ("foo, bar, and baz") \ No newline at end of file +print("Hello, world.") \ No newline at end of file diff --git a/src/ludus/core.clj b/src/ludus/core.clj index f110698..9debbb4 100644 --- a/src/ludus/core.clj +++ b/src/ludus/core.clj @@ -20,8 +20,8 @@ (pp/pprint (:errors parsed)) (System/exit 66)) (let [interpreted (interpreter/interpret parsed)] - (println " *** *** ***") - (println "I ran your script; here's the output: ") + ;;(println " *** *** ***") + ;;(println "I ran your script; here's the output: ") (pp/pprint interpreted) (System/exit 0))))))) diff --git a/src/ludus/interpreter.clj b/src/ludus/interpreter.clj index 05a5b0a..4cc562a 100644 --- a/src/ludus/interpreter.clj +++ b/src/ludus/interpreter.clj @@ -11,7 +11,7 @@ ;; it's got runtime checking ;; we should be able to do these checks statically ;; that's for later, tho -(defn- resolve [word ctx-atom] +(defn- resolve-word[word ctx-atom] (let [ctx @ctx-atom] (if (contains? ctx word) (get ctx word) @@ -207,7 +207,7 @@ ::ast/atom (:value ast) - ::ast/word (resolve (:word ast) ctx) + ::ast/word (resolve-word(:word ast) ctx) ::ast/let (interpret-let ast ctx) diff --git a/src/ludus/parser.clj b/src/ludus/parser.clj index e8e79be..db869bb 100644 --- a/src/ludus/parser.clj +++ b/src/ludus/parser.clj @@ -13,7 +13,7 @@ (defn- current [parser] (nth (::tokens parser) (::token parser) nil)) -(defn- peek [parser] +(defn- ppeek [parser] (nth (::tokens parser) (inc (::token parser)) nil)) (defn- at-end? [parser] @@ -41,7 +41,7 @@ ::token/rbrace ::token/eof}) -(defn- sync [parser message origin end] +(defn- psync [parser message origin end] (let [poison {::ast/type ::ast/poison :message message :origin origin @@ -63,7 +63,7 @@ (let [curr (current parser) type (::token/type curr)] (if (or (at-end? parser) (contains? sync-on type)) - (sync parser message origin curr) + (psync parser message origin curr) (recur (advance parser)))))))) ;; some helper functions @@ -548,14 +548,14 @@ (parse-atom parser) ::token/keyword - (let [next (peek parser) + (let [next (ppeek parser) type (::token/type next)] (if (= type ::token/lparen) (parse-synthetic parser) (parse-atom parser))) ::token/word - (let [next (peek parser) + (let [next (ppeek parser) type (::token/type next)] (case type (::token/lparen ::token/keyword) (parse-synthetic parser) diff --git a/src/ludus/prelude.clj b/src/ludus/prelude.clj index 74bbe3d..a67c3d2 100644 --- a/src/ludus/prelude.clj +++ b/src/ludus/prelude.clj @@ -22,11 +22,11 @@ ::data/type ::data/clj :body /}) -(def inc {:name "inc" +(def inc- {:name "inc" ::data/type ::data/clj :body inc}) -(def dec {:name "dec" +(def dec- {:name "dec" ::data/type ::data/clj :body dec}) @@ -38,7 +38,7 @@ ::data/type ::data/clj :body (fn [& args] (throw (ex-info "Ludus panicked!" {:args args})))}) -(def print {:name "print" +(def print- {:name "print" ::data/type ::data/clj :body (fn [& args] (println (str args)) @@ -47,10 +47,10 @@ (def prelude {"eq" eq "add" add "panic!" panic! - "print" print + "print" print- "sub" sub "mult" mult "div" div - "inc" inc - "dec" dec + "inc" inc- + "dec" dec- "not" not}) \ No newline at end of file