Mercerenies / gdlisp

Lisp on the Godot platform
GNU General Public License v3.0
141 stars 1 forks source link

Comments #8

Closed Mercerenies closed 3 years ago

Mercerenies commented 3 years ago

Yeah, we need to have comments. This is unfortunately nontrivial as it means we have to scrap the default LALRPOP lexer and write our own lexer from scratch.

Current plan is to not compile comments into the resulting GDScript at all. Possibly, at some point in the future, we may make it so that you can pass through comments with a special syntax or compiler flag, but the default will be to strip them.

Line comments will use semicolons as they do in most Lisps

; Line Comment

Block comments I'm undecided on. We have a few options, and they're listed here roughly in decreasing order of my personal preference right now.

#| The Common Lisp Way |#
/* The C/C++ Way */
"""The Python Way"""
(comment The Clojure Way)
Mercerenies commented 3 years ago

This is unfortunately nontrivial as it means we have to scrap the default LALRPOP lexer and write our own lexer from scratch.

Mercifully, this was incorrect. You can actually disable the default space-skipping rules of LALRPOP's lexer. We may have to make our own lexer sometime, but that day is not today.

89a6aab implements line comments, preceded by a semicolon. This resolves the first half of this issue and only leaves block comments.