diff --git a/lib/aids.klambda b/lib/aids.klambda new file mode 100644 index 0000000..a42514b --- /dev/null +++ b/lib/aids.klambda @@ -0,0 +1,15 @@ +: get it? because std? +: i'm hilarious. + +(defun spit + (id miracle + "builtins" "print" (id $1)) +) +(defun input + (id miracle + "builtins" "input" ("")) +) +(defun thesis + (id spit + ("this language belongs to makise kurisu. there are many like it, but this one is hers.")) +) \ No newline at end of file diff --git a/main.py b/main.py index 4cf5da0..b5152d2 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,21 @@ def isnum(n): return True reps = ["(", ")", "\"", ","] f = open(sys.argv[1]).read() + +def expand(file): + tmp = file.split("\n") + for idx, i in enumerate(tmp): + if len(i) < 1: + continue + elif i[:8] == "INCLUDE:": + tmp[idx] = expand(open(i[8:]).read()) + elif i[0] == ":": + tmp.pop(idx) + return "\n".join(tmp) + +f = expand(f) + + f = f.replace(" ", " RDANEELOLIVAW ") # spacer for r in reps: f = f.replace(r, " "+r+" ") f = f.split() diff --git a/test.klambda b/test.klambda index 7b0691d..7f2272f 100644 --- a/test.klambda +++ b/test.klambda @@ -1,15 +1,4 @@ -(defun spit - (id miracle - "builtins" "print" (id $1)) -) -(defun input - (id miracle - "builtins" "input" ("")) -) -(defun thesis - (id spit - ("this language belongs to makise kurisu. there are many like it, but this one is hers.")) -) +INCLUDE:./lib/aids.klambda (def a (id (id "desu"))) (spit @@ -20,7 +9,6 @@ (id spit ("one")) (id spit ("zero")) ) -(thesis) (spit ("how old are you? > ")) (def age (conv number (input))) @@ -31,4 +19,6 @@ "not adult" ) ) -) \ No newline at end of file +) + +(thesis) \ No newline at end of file