JS designed for Macros.
Schript will be a JavaScript dialect made more uniform, like Scheme. This allows for user-defined macros to work in a natural way; this is the primary motivation of the project.
defun(fact, n) {
if(n) {
*(n,fact(n-1))
} {
return(1)
}
}
define(x, 5)
write("Hello, World")
Macros have been implemented to allow syntax definition within programs. The following defines a let
macro which will serve to define a variable over the scope of a block.
defmacro(let, name, val, expr) {
defun(tmp, `name) {
return(`expr)
}
tmp(`val)
}
let(a, 56) {
write(a)
}
Note the back-tick notation which denotes an expression as a value to be inserted into the returned syntax; all other expressions are evaluated upon invocation of the macro.