GDLisp is a lisp dialect that compiles to GDScript.
(print"Hello,world!")
Produces (when run):
print("Hello,world!")
GDLisp is a way to write script files for the Godot engine without actually writing (directly) in the scripting language it provides.
The main benefits this provides is that you can write macros and (hopefully) enter into Lisp game jams. Also you don’t have to deal with semantic whitespace.
A GDLisp script has the following grammar:
Where escape-stmts are put directly into the surrounding module, and top-class-stmts are interpreted as a GDLisp class.
Statements and expressions have the following grammar:
Syntax transformers are expanded (roughly) as usual.
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
There are a few caveats and things to note about GDLisp.
Racket identifiers used as variables are mangled before being emitted as GDScript, so they are valid GDScript identifiers. Most notably, hyphens ("-") are converted to underscores ("_"). Names that mangle to the same identifier will conflict. This does also mean that macros which introduce variable bindings are unhygienic. Use (gensym) if you need a name which doesn’t conflict.