aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-01-06 03:31:16 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-01-06 03:31:16 +0300
commite7529f3a331ec21c40ff1940603fc06f80d54854 (patch)
tree3079c228188cac47f3475bcbe560a28e0108e848
parent94ebec008ef085ac6973d89cf6722eb348d4e9d9 (diff)
downloadcsx-e7529f3a331ec21c40ff1940603fc06f80d54854.tar
csx-e7529f3a331ec21c40ff1940603fc06f80d54854.tar.xz
csx-e7529f3a331ec21c40ff1940603fc06f80d54854.zip
Fix of fix.
-rw-r--r--examples/interpreter.csx39
1 files changed, 37 insertions, 2 deletions
diff --git a/examples/interpreter.csx b/examples/interpreter.csx
index 7df8ffc..b82caab 100644
--- a/examples/interpreter.csx
+++ b/examples/interpreter.csx
@@ -138,7 +138,7 @@
] num] num]
]]
-[set readname [fn [] [output [str [head linep]] newline]
+[set readname [fn []
[if [head linep] [if [no [same [head [head linep]] [" " 0]]]
[if [no [same [head [head linep]] ["[" 0]]] [if [no [same [head [head linep]] ["]" 0]]] [do
[if [same [head [head linep]] ["\\" 0]] [sethead linep [tail [head linep]]]]
@@ -158,7 +158,7 @@
] [sethead linep [tail [head linep]]]]]
]]
-[set readobj [fn [] [output [str [head linep]] newline] [if
+[set readobj [fn [] [if
[same [head [head linep]] ["{" 0]] [do
[sethead linep [tail [head linep]]]
[readcomment]
@@ -210,4 +210,39 @@
]]
[output "-= CSX interpreter loaded =-" newline]
+[output "========= Base functions: ========================================" newline]
+[output "[set name value] | name will have the value value" newline]
+[output "[set? name] | check if name is set as some value" newline]
+[output "[sethead p v] | head of p will be changed to the v value" newline]
+[output "[settail p v] | head of p will be changed to the v value" newline]
+[output "[pair head tail] | creates pair of head and value" newline]
+[output "[head pair] | returns head of pair" newline]
+[output "[tail pair] | returns tail of pair" newline]
+[output "[quote x] | returns unevaluated x" newline]
+[output "[same a b] | checks if a and b are the same thing" newline]
+[output "[type x] | returns type of x" newline]
+[output "[do ...] | runs statements returning value of the last one" newline]
+[output "[fn args ...] | creates function" newline]
+[output " | you can make vararg function with pairs" newline]
+[output "[sx args ...] | same as fn but for macro" newline]
+[output "[if a b ... c] | executes b if a (for each a), else c" newline]
+[output "[+ ...] | sum of the arguments" newline]
+[output "[* ...] | product of the arguments" newline]
+[output "[neg a] | negate a" newline]
+[output "[div a b] | a / b" newline]
+[output "[mod a b] | a % b" newline]
+[output "[< ...] | checks if arguments are increasing" newline]
+[output "[> ...] | checks if arguments are decreasing" newline]
+[output "[out ch] | outputs character with ch code" newline]
+[output "[in] | null if input ended, else character code" newline]
+[output "[name str] | creates name from str string" newline]
+[output "[str obj] | creates str from name or list of codes" newline]
+[output "[len obj] | length of list or string" newline]
+[output "[run x] | runs the x expression" newline]
+[output "[run x context] | runs the x expression in given context" newline]
+[output " | returns pair of value and new context" newline]
+[output "[context] | returns current context" newline]
+[output "[newcontext] | returns new base context" newline]
+[output "==================================================================" newline]
+[output "Have a good time!" newline]
[read [newcontext]]