Compare commits

..

No commits in common. "d12d48558327256522fad7e4497755dcf716f678" and "20ea25761ac1a66398488d6b79e752cb05bb296f" have entirely different histories.

13 changed files with 22 additions and 4138 deletions

3
foo.ld
View File

@ -1,2 +1 @@
& EXPECT "foo" :foo
"foo"

View File

@ -3,4 +3,4 @@ repl:
clj -X:repl clj -X:repl
build: build:
shadow-cljs release module shadow-cljs release node

4100
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,14 +3,12 @@
"version": "0.1.0-alpha.7.9", "version": "0.1.0-alpha.7.9",
"description": "A Ludus interpreter in a pure JS function.", "description": "A Ludus interpreter in a pure JS function.",
"main": "target/js/ludus.js", "main": "target/js/ludus.js",
"type": "module",
"directories": {}, "directories": {},
"keywords": [], "keywords": [],
"author": "Scott Richmond", "author": "Scott Richmond",
"license": "GPL-3.0", "license": "GPL-3.0",
"files": "target/js/*",
"devDependencies": { "devDependencies": {
"shadow-cljs": "^2.26.0", "shadow-cljs": "^2.26.0"
"tap": "^18.6.1" },
} "dependencies": {}
} }

View File

@ -5,13 +5,9 @@
:builds :builds
{:node {:target :node-library {:node {:target :node-library
:output-to "target/js/ludus.js" :output-to "target/js/ludus.js"
:exports {:run ludus.node/run} :exports {:run ludus.node/run}
:modules {:main {:entries [ludus.node]}}} :modules {:main {:entries [ludus.node]}}}
:module {:target :esm
:output-dir "target/js"
:modules {:ludus {:exports {run ludus.node/run test ludus.node/run-test}}}
}
:browser {:target :browser :browser {:target :browser
:output-dir "target/js" :output-dir "target/js"
:asset-path "target" :asset-path "target"

View File

@ -64,7 +64,7 @@
(defn test-run [source] (run source true)) (defn test-run [source] (run source true))
(comment (do
(def source " (def source "

View File

@ -1,7 +0,0 @@
& EXPECT (:true, :false, :true, :false)
let true_literal = if true then :true else :false
let false_literal = if false then :true else :false
let truthy = if :truthy then :true else :false
let falsy = if nil then :true else :false
(true_literal, false_literal, truthy, falsy)

View File

@ -1,2 +0,0 @@
& EXPECT [:one, 2, "three"]
[:one, 2, "three"]

View File

@ -1,2 +0,0 @@
& EXPECT 12.123
12.123

View File

@ -1,2 +0,0 @@
& EXPECT 42
42

View File

@ -1,2 +0,0 @@
& EXPECT "foo"
"foo"

View File

@ -1,2 +0,0 @@
& EXPECT (true, false, nil)
(true, false, nil)

View File

@ -1,18 +0,0 @@
import {run} from "../target/js/ludus.js"
import * as fs from "node:fs/promises"
import t from "tap"
const case_path = "./cases"
const files = await fs.readdir(case_path)
for (const file of files) {
const script = await fs.readFile(`${case_path}/${file}`, {encoding: "utf8"})
const first_line = script.split("\n")[0]
const expected = first_line.split("EXPECT")[1].trim()
const result = run(script).result
t.test(`testing ${file}: EXPECT ${expected}, GOT ${result}`,
t => {
t.equal(expected, result)
t.end()
})
}