diff --git a/kiss/.haxerc b/kiss/.haxerc deleted file mode 100644 index d5fb046d..00000000 --- a/kiss/.haxerc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": "4.3.0", - "resolveLibs": "scoped" -} \ No newline at end of file diff --git a/kiss/README.md b/kiss/README.md deleted file mode 100644 index c54d309f..00000000 --- a/kiss/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Kiss - -*A type-safe, compiled Lisp for Haxe programs* - -[![Build Status](https://github.com/NQNStudios/kisslang/actions/workflows/test.yml/badge.svg)](https://github.com/NQNStudios/kisslang/actions/workflows/test.yml) - -## What is Kiss? - -Kiss is a work in progress. (See: [Who should use Kiss?](#who-should-use-kiss)) - -Kiss aims to be a statically typed Lisp that runs correctly almost anywhere using Haxe's FFI features. - -**Main features:** - -- [x] Traditional Lisp macros -- [x] Rust-style pattern-matching -- [x] [Reader macros](https://gist.github.com/chaitanyagupta/9324402) -- [x] Plug-and-play with every pure-Haxe library on Haxelib -- [x] Smooth FFI with any non-Haxe library you can find or write Haxe bindings for -- [x] helpful compiler errors - -**Extra goodies:** - -- [x] string interpolation -- [x] Rust-style raw string literals -- [x] syntactic sugar for Promise-based asynchronous code -- [x] negative indexing -- [x] list comprehensions -- [x] immutability by default -- [x] destructuring assignment - -## How does it work? - -Kiss - -* reads Kiss code from .kiss files -* converts the Kiss expressions into [Haxe macro expressions](https://api.haxe.org/haxe/macro/Expr.html) -* provides a [builder macro](https://haxe.org/manual/macro-type-building.html) which adds your Kiss functions to your Haxe classes before compiling - -By compiling into Haxe expressions, Kiss leverages all of the cross-target, cross-platform, type-safety, and null-safety features of the Haxe language. - -## Why? - -I've been working on a Haxe-based interpreted Lisp called [Hiss](https://github.com/hissvn/hiss) since December 2019. I had to rewrite Hiss from scratch at least once. I've learned so much from writing Hiss, but it has majorly slowed down the productivity of Hiss-based projects because it is so complex, fast-changing, and prone to runtime errors. Kiss is like a Kompiled hISS, and a reminder to Keep It Simple, Stupid. - -## What does the license mean? - -Licenses are confusing and GPL licenses can be intimidating. I've chosen the LGPL because I never want any big corporation to profit from my work. If you are an independent developer/studio with good intentions, I'm willing to negotiate usage of Kiss under a different license on a case-by-case basis. - -## Who should use Kiss? - -As of now: - -* Language design enthusiasts -* Hobbyists writing **disposable** code without deadlines - -Hopefully someday: - -* Professional game developers who want to learn the ways of Lisp - -## Limitations - -* No pattern matching in macros -* No type checking in macro definitions -* Macros are extremely hard to debug \ No newline at end of file diff --git a/kiss/build-scripts/common-args.hxml b/kiss/build-scripts/common-args.hxml deleted file mode 100644 index 9f3797a8..00000000 --- a/kiss/build-scripts/common-args.hxml +++ /dev/null @@ -1,11 +0,0 @@ --w -WUnusedPattern --lib hscript --lib uuid --lib tink_macro --lib tink_json --lib tink_syntaxhub --lib haxe-strings --cp kiss/src --cp cloner/src --D analyzer-optimize ---macro kiss.KissFrontend.use() \ No newline at end of file diff --git a/kiss/build-scripts/common-test-args.hxml b/kiss/build-scripts/common-test-args.hxml deleted file mode 100644 index 5abc7afa..00000000 --- a/kiss/build-scripts/common-test-args.hxml +++ /dev/null @@ -1,6 +0,0 @@ --lib utest --D test --D hscriptPos --D var1ForCase=var1 --D var2ForCase=var2 ---main test.TestMain \ No newline at end of file diff --git a/kiss/build-scripts/cpp/test-cpp.sh b/kiss/build-scripts/cpp/test-cpp.sh deleted file mode 100755 index de641c46..00000000 --- a/kiss/build-scripts/cpp/test-cpp.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/bash -./bin/cpp/test/TestMain \ No newline at end of file diff --git a/kiss/build-scripts/cpp/test.hxml b/kiss/build-scripts/cpp/test.hxml deleted file mode 100644 index df7e0b3d..00000000 --- a/kiss/build-scripts/cpp/test.hxml +++ /dev/null @@ -1,3 +0,0 @@ --lib hxcpp --cpp bin/cpp/test --cmd bash kiss/build-scripts/cpp/test-cpp.sh \ No newline at end of file diff --git a/kiss/build-scripts/cs/test-cs.sh b/kiss/build-scripts/cs/test-cs.sh deleted file mode 100755 index 64d417ee..00000000 --- a/kiss/build-scripts/cs/test-cs.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/bash -mono bin/cs/test/bin/TestMain.exe \ No newline at end of file diff --git a/kiss/build-scripts/cs/test.hxml b/kiss/build-scripts/cs/test.hxml deleted file mode 100644 index a68aedef..00000000 --- a/kiss/build-scripts/cs/test.hxml +++ /dev/null @@ -1,3 +0,0 @@ --lib hxcs --cs bin/cs/test --cmd bash kiss/build-scripts/cs/test-cs.sh \ No newline at end of file diff --git a/kiss/build-scripts/dts2hx-externs/KillVersionReqs.hx b/kiss/build-scripts/dts2hx-externs/KillVersionReqs.hx deleted file mode 100644 index babb6a4c..00000000 --- a/kiss/build-scripts/dts2hx-externs/KillVersionReqs.hx +++ /dev/null @@ -1,19 +0,0 @@ -package; - -import sys.io.File; -import sys.FileSystem; -import haxe.Json; - -class KillVersionReqs { - static function main() { - var libs = FileSystem.readDirectory("libs"); - for (lib in libs) { - var haxelib = 'libs/$lib/$lib/haxelib.json'; - var json = Json.parse(File.getContent(haxelib)); - for (dependency => version in (json.dependencies : haxe.DynamicAccess)) { - json.dependencies[dependency] = ""; - } - File.saveContent(haxelib, Json.stringify(json)); - } - } -} \ No newline at end of file diff --git a/kiss/build-scripts/dts2hx-externs/regenerate.sh b/kiss/build-scripts/dts2hx-externs/regenerate.sh deleted file mode 100755 index 769248bd..00000000 --- a/kiss/build-scripts/dts2hx-externs/regenerate.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/bash - -if [ -d libs ]; then - rm -rf libs -fi - -if [ -d .haxelib ]; then - rm -rf .haxelib -fi - -mkdir libs -npm install . - -cd .haxelib - -libs=* -for lib in $libs; do - mv $lib ../libs/$lib -done - -cd .. -rm -rf .haxelib - -cd libs -libs=* -for lib in $libs; do - mv $lib/**/ $lib/$lib - haxelib dev $lib $lib/$lib/ -done -cd .. -cp $(haxelib libpath kiss)/build-scripts/dts2hx-externs/KillVersionReqs.hx ./ -haxe --main KillVersionReqs --interp -rm KillVersionReqs.hx \ No newline at end of file diff --git a/kiss/build-scripts/interp/test.hxml b/kiss/build-scripts/interp/test.hxml deleted file mode 100644 index 7aa3ac0f..00000000 --- a/kiss/build-scripts/interp/test.hxml +++ /dev/null @@ -1 +0,0 @@ ---interp \ No newline at end of file diff --git a/kiss/build-scripts/js/test.hxml b/kiss/build-scripts/js/test.hxml deleted file mode 100644 index eedcbcfa..00000000 --- a/kiss/build-scripts/js/test.hxml +++ /dev/null @@ -1,2 +0,0 @@ ---js bin/js/test.js ---cmd node bin/js/test.js \ No newline at end of file diff --git a/kiss/build-scripts/neko/test.hxml b/kiss/build-scripts/neko/test.hxml deleted file mode 100644 index f14ed6a7..00000000 --- a/kiss/build-scripts/neko/test.hxml +++ /dev/null @@ -1,2 +0,0 @@ --neko bin/neko/test.n --cmd neko bin/neko/test.n \ No newline at end of file diff --git a/kiss/build-scripts/nodejs/test.hxml b/kiss/build-scripts/nodejs/test.hxml deleted file mode 100644 index 2a197f12..00000000 --- a/kiss/build-scripts/nodejs/test.hxml +++ /dev/null @@ -1,3 +0,0 @@ --lib hxnodejs ---js bin/nodejs/test.js ---cmd node bin/nodejs/test.js \ No newline at end of file diff --git a/kiss/build-scripts/py/test-py.sh b/kiss/build-scripts/py/test-py.sh deleted file mode 100755 index 4d1f8009..00000000 --- a/kiss/build-scripts/py/test-py.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/bash - -# "python" is supposed to mean Python3 everywhere now, but not in practice -if [ ! -z "$(which python3)" ]; then - python3 bin/py/test.py -else - python bin/py/test.py -fi \ No newline at end of file diff --git a/kiss/build-scripts/py/test.hxml b/kiss/build-scripts/py/test.hxml deleted file mode 100644 index 1989e692..00000000 --- a/kiss/build-scripts/py/test.hxml +++ /dev/null @@ -1,2 +0,0 @@ ---python bin/py/test.py ---cmd bash kiss/build-scripts/py/test-py.sh \ No newline at end of file diff --git a/kiss/build.hxml b/kiss/build.hxml deleted file mode 100644 index 3ad992f4..00000000 --- a/kiss/build.hxml +++ /dev/null @@ -1,6 +0,0 @@ --cp src --lib hscript --lib uuid --lib tink_macro ---main kiss.Main ---interp \ No newline at end of file diff --git a/kiss/extraParams.hxml b/kiss/extraParams.hxml deleted file mode 100644 index 49311780..00000000 --- a/kiss/extraParams.hxml +++ /dev/null @@ -1,2 +0,0 @@ --w -WUnusedPattern ---macro kiss.KissFrontend.use() \ No newline at end of file diff --git a/kiss/haxe_libraries/haxe-strings.hxml b/kiss/haxe_libraries/haxe-strings.hxml deleted file mode 100644 index e5c6cbd9..00000000 --- a/kiss/haxe_libraries/haxe-strings.hxml +++ /dev/null @@ -1,5 +0,0 @@ -# @install: lix --silent download "haxelib:/haxe-strings#7.0.2" into haxe-strings/7.0.2/haxelib --cp ${HAXE_LIBCACHE}/haxe-strings/7.0.2/haxelib/src/ --D haxe-strings=7.0.2 ---macro hx.strings.internal.Macros.addDefines() ---macro hx.strings.internal.Macros.configureNullSafety() diff --git a/kiss/haxe_libraries/hscript.hxml b/kiss/haxe_libraries/hscript.hxml deleted file mode 100644 index 106e1f88..00000000 --- a/kiss/haxe_libraries/hscript.hxml +++ /dev/null @@ -1,5 +0,0 @@ -# @install: lix --silent download "haxelib:/hscript#2.5.0" into hscript/2.5.0/haxelib -# @run: haxelib run-dir hscript "${HAXE_LIBCACHE}/hscript/2.5.0/haxelib" --cp ${HAXE_LIBCACHE}/hscript/2.5.0/haxelib/ --D hscript=2.5.0 ---macro keep('IntIterator') \ No newline at end of file diff --git a/kiss/haxe_libraries/tink_core.hxml b/kiss/haxe_libraries/tink_core.hxml deleted file mode 100644 index 37a0d96a..00000000 --- a/kiss/haxe_libraries/tink_core.hxml +++ /dev/null @@ -1,3 +0,0 @@ -# @install: lix --silent download "haxelib:/tink_core#2.1.0" into tink_core/2.1.0/haxelib --cp ${HAXE_LIBCACHE}/tink_core/2.1.0/haxelib/src --D tink_core=2.1.0 \ No newline at end of file diff --git a/kiss/haxe_libraries/tink_json.hxml b/kiss/haxe_libraries/tink_json.hxml deleted file mode 100644 index b167de7c..00000000 --- a/kiss/haxe_libraries/tink_json.hxml +++ /dev/null @@ -1,4 +0,0 @@ -# @install: lix --silent download "haxelib:/tink_json#0.11.0" into tink_json/0.11.0/haxelib --lib tink_typecrawler --cp ${HAXE_LIBCACHE}/tink_json/0.11.0/haxelib/src --D tink_json=0.11.0 \ No newline at end of file diff --git a/kiss/haxe_libraries/tink_macro.hxml b/kiss/haxe_libraries/tink_macro.hxml deleted file mode 100644 index a9e19b1f..00000000 --- a/kiss/haxe_libraries/tink_macro.hxml +++ /dev/null @@ -1,4 +0,0 @@ -# @install: lix --silent download "haxelib:/tink_macro#1.0.1" into tink_macro/1.0.1/haxelib --lib tink_core --cp ${HAXE_LIBCACHE}/tink_macro/1.0.1/haxelib/src --D tink_macro=1.0.1 \ No newline at end of file diff --git a/kiss/haxe_libraries/tink_priority.hxml b/kiss/haxe_libraries/tink_priority.hxml deleted file mode 100644 index 98cfa803..00000000 --- a/kiss/haxe_libraries/tink_priority.hxml +++ /dev/null @@ -1,3 +0,0 @@ --D tink_priority=0.1.3 -# @install: lix --silent download "gh://github.com/haxetink/tink_priority#ea736d31dc788aae703a2aa415c25d5b80d0e7d1" into tink_priority/0.1.3/github/ea736d31dc788aae703a2aa415c25d5b80d0e7d1 --cp ${HAXE_LIBCACHE}/tink_priority/0.1.3/github/ea736d31dc788aae703a2aa415c25d5b80d0e7d1/src diff --git a/kiss/haxe_libraries/tink_syntaxhub.hxml b/kiss/haxe_libraries/tink_syntaxhub.hxml deleted file mode 100644 index e3c7d2b2..00000000 --- a/kiss/haxe_libraries/tink_syntaxhub.hxml +++ /dev/null @@ -1,6 +0,0 @@ -# @install: lix --silent download "gh://github.com/haxetink/tink_syntaxhub#b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86" into tink_syntaxhub/0.6.0/github/b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86 --lib tink_macro --lib tink_priority --cp ${HAXE_LIBCACHE}/tink_syntaxhub/0.6.0/github/b6ea4966bbdee4d176ac8dd5d2d8ae3b362b2f86/src --D tink_syntaxhub=0.6.0 ---macro tink.SyntaxHub.use() \ No newline at end of file diff --git a/kiss/haxe_libraries/tink_typecrawler.hxml b/kiss/haxe_libraries/tink_typecrawler.hxml deleted file mode 100644 index 373aee96..00000000 --- a/kiss/haxe_libraries/tink_typecrawler.hxml +++ /dev/null @@ -1,4 +0,0 @@ -# @install: lix --silent download "haxelib:/tink_typecrawler#0.7.0" into tink_typecrawler/0.7.0/haxelib --lib tink_macro --cp ${HAXE_LIBCACHE}/tink_typecrawler/0.7.0/haxelib/src --D tink_typecrawler=0.7.0 \ No newline at end of file diff --git a/kiss/haxe_libraries/uuid.hxml b/kiss/haxe_libraries/uuid.hxml deleted file mode 100644 index ff1269ba..00000000 --- a/kiss/haxe_libraries/uuid.hxml +++ /dev/null @@ -1,3 +0,0 @@ -# @install: lix --silent download "haxelib:/uuid#2.4.1" into uuid/2.4.1/haxelib --cp ${HAXE_LIBCACHE}/uuid/2.4.1/haxelib/src --D uuid=2.4.1 \ No newline at end of file diff --git a/kiss/haxelib.json b/kiss/haxelib.json deleted file mode 100644 index c1441600..00000000 --- a/kiss/haxelib.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "kiss", - "url": "https://github.com/NQNStudios/kisslang", - "license": "LGPL", - "tags": ["cross"], - "description": "", - "version": "0.0.1", - "releasenote": "It isn't safe to use this library yet.", - "contributors": ["NQNStudios"], - "classPath": "src/", - "main": "kiss.Main", - "dependencies": { - "hscript": "", - "uuid": "", - "tink_macro": "", - "tink_json": "", - "tink_syntaxhub": "", - "haxe-strings": "" - } -} \ No newline at end of file diff --git a/kiss/src/kiss/AsyncEmbeddedScript.hx b/kiss/src/kiss/AsyncEmbeddedScript.hx deleted file mode 100644 index fca46882..00000000 --- a/kiss/src/kiss/AsyncEmbeddedScript.hx +++ /dev/null @@ -1,245 +0,0 @@ -package kiss; - -#if macro -import haxe.macro.Expr; -import haxe.macro.Context; -import haxe.macro.PositionTools; -import sys.io.File; -import haxe.io.Path; -using kiss.Helpers; -#end - -import kiss.Kiss; -import kiss.ReaderExp; -import kiss.Prelude; -import kiss.cloner.Cloner; -using StringTools; - -typedef Continuation = () -> Void; -typedef AsyncCommand = (AsyncEmbeddedScript, Continuation) -> Void; - -/** - Utility class for making statically typed, debuggable, ASYNC-BASED embedded Kiss-based DSLs. - Examples are in the hollywoo project. -**/ -class AsyncEmbeddedScript { - private var instructions:Array = null; - private var breakPoints:Map Bool> = []; - private var onBreak:AsyncCommand = null; - private var lastInstructionPointer = -1; - private var labels:Map = []; - private var noSkipInstructions:Map = []; - - public function setBreakHandler(handler:AsyncCommand) { - onBreak = handler; - } - - public function addBreakPoint(instruction:Int, ?condition:() -> Bool) { - if (condition == null) { - condition = () -> true; - } - breakPoints[instruction] = condition; - } - - public function removeBreakPoint(instruction:Int) { - breakPoints.remove(instruction); - } - - public function new() {} - - private function resetInstructions() {} - - public function instructionCount() { - if (instructions == null) - resetInstructions(); - return instructions.length; - } - - private function runInstruction(instructionPointer:Int, withBreakPoints = true) { - lastInstructionPointer = instructionPointer; - if (instructions == null) - resetInstructions(); - if (withBreakPoints && breakPoints.exists(instructionPointer) && breakPoints[instructionPointer]()) { - if (onBreak != null) { - onBreak(this, () -> runInstruction(instructionPointer, false)); - } - } - var continuation = if (instructionPointer < instructions.length - 1) { - () -> { - // runInstruction may be called externally to skip through the script. - // When this happens, make sure other scheduled continuations are canceled - // by verifying that lastInstructionPointer hasn't changed - if (lastInstructionPointer == instructionPointer) { - runInstruction(instructionPointer + 1); - } - }; - } else { - () -> {}; - } - instructions[instructionPointer](this, continuation); - } - - public function run(withBreakPoints = true) { - runInstruction(0, withBreakPoints); - } - - private function skipToInstruction(ip:Int) { - var lastCC = ()->runInstruction(ip); - // chain together the unskippable instructions prior to running the requested ip - var noSkipList = []; - for (cIdx in lastInstructionPointer+1... ip) { - if (noSkipInstructions.exists(cIdx)) { - noSkipList.push(cIdx); - } - } - if (noSkipList.length > 0) { - var cc = null; - cc = ()->{ - if (noSkipList.length == 0) { - lastCC(); - } else { - var inst = noSkipList.shift(); - lastInstructionPointer = inst; - instructions[inst](this, cc); - } - }; - cc(); - } else { - lastCC(); - } - - // TODO remember whether breakpoints were requested - } - - public function skipToNextLabel() { - var labelPointers = [for (ip in labels) ip]; - labelPointers.sort(Reflect.compare); - for (ip in labelPointers) { - if (ip > lastInstructionPointer) { - skipToInstruction(ip); - break; - } - } - } - - public function skipToLabel(name:String) { - var ip = labels[name]; - if (lastInstructionPointer > ip) { - throw "Rewinding AsyncEmbeddedScript is not implemented"; - } - skipToInstruction(ip); - } - - public function labelRunners():MapVoid> { - return [for (label => ip in labels) label => () -> skipToInstruction(ip)]; - } - - #if macro - public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array { - // trace('AsyncEmbeddedScript.build $dslHaxelib $dslFile $scriptFile'); - var k = Kiss.defaultKissState(); - - k.file = scriptFile; - var classPath = Context.getPosInfos(Context.currentPos()).file; - var loadingDirectory = Path.directory(classPath); - var classFields = []; // Kiss.build() will already include Context.getBuildFields() - - var commandList:Array = []; - var labelsList:Array = []; - var noSkipList:Array = []; - - var labelNum = 0; - k.macros["label"] = (wholeExp:ReaderExp, args:Array, k:KissState) -> { - wholeExp.checkNumArgs(1, 1, '(label