Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: implementing read macros #167

Open
jasonsbarr opened this issue Oct 25, 2021 · 0 comments
Open

Question: implementing read macros #167

jasonsbarr opened this issue Oct 25, 2021 · 0 comments

Comments

@jasonsbarr
Copy link

jasonsbarr commented Oct 25, 2021

I'm looking to generate a lexer and parser for a Lisp-like language. Generally this should be a pretty simple task, since Lisp is really easy to parse, but there's one thing I'm not sure about.

It's common in Lisps to have read macros that transform the input string before it's tokenized. The simplest and probably most-used example in practice is something like this:

'hello

which is transformed by the reader into

(quote hello)

before being parsed.

Is there any way to do that sort of processing with a Moo lexer, or do I need to do that transformation prior to lexing?

Doing the transformation first should be a trivial exercise, but I'd like to preserve line and column info from the original code, which makes it a bit more sticky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant