-
Notifications
You must be signed in to change notification settings - Fork 82
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
Agda-style Lexing #203
Comments
In Agda, identifiers and operators need to be white-space separated. Frankly, I do not understand what you are intending here, or how Alex should be changed. At its core Alex implements traditional 1960s style lexing (classic "formal languages and automata" stuff). |
@andreasabel Well, for example, does the Agda lexer use copious right contexts to to find those whitespace boundaries? The current Alex docs warn that right contexts can make things slow, but I suspect either the warning is overly pessimistic, or the situation can be improved. |
I have been mulling this for a while, but the difficulties in fixing #197 made it feel more urgent.
As a (rare) user of Adga, I have been very fond of it's lexing, which seems very simple, and more concerned with the boundaries between tokens rather than the contents of tokens themselves. (You can seem me singing its praises in, e.g. ghc-proposals/ghc-proposals#444 (comment)).
I have a few questions on this.
Do the people implementing Agda agree with this premise, that lexing in Agda is significantly different and/or simpler than that in other languages? Or am I reading to much into it as a user guessing how it works?
If the premise is valid (per question 1), is there anything Alex might do to make this easier / a more obvious way to do things? I suppose I should study https://github.com/agda/agda/blob/master/src/full/Agda/Syntax/Parser/Lexer.x
Should we transition Alex itself to lex more in this style, basically requiring more things to be space-separated?
CC @andreasabel who conveniently works on both Alex and Agda, and @int-index who spearheaded the similar left right lexing context rules for Haskell.
The text was updated successfully, but these errors were encountered: