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

Bqn lexer: lexer for the BQN array programming language #2472

Merged
merged 8 commits into from Jul 18, 2023

Conversation

mutable-learning
Copy link
Contributor

This is a pretty simple lexer based on the APL lexer. APL was the inspiration for BQN and the main differences are the unicode characters used for functions and BQN supports more features of other functional programming languages than APL.

The language documentation can be found at https://mlochbaum.github.io/BQN/doc/index.html

Thanks

@jeanas
Copy link
Contributor

jeanas commented Jul 12, 2023

If it's almost a clone of APL, is there a way to make it a subclass of the APL lexer? (See https://pygments.org/docs/lexerdevelopment/#subclassing-lexers-derived-from-regexlexer)

@mutable-learning
Copy link
Contributor Author

If it's almost a clone of APL, is there a way to make it a subclass of the APL lexer? (See https://pygments.org/docs/lexerdevelopment/#subclassing-lexers-derived-from-regexlexer)

The languages are very similar in many ways, but most of the syntax is different. If we subclass the APL lexer there are only 4 rules that would be the same out of 19 as it stands currently.

Is it possible to use the inherit special object in the root state but specify only a subset of rules to be inherited? The docs don't explain this from what I can find. If not, is there any point in sub classing as inherit will not be used at all?

@jeanas
Copy link
Contributor

jeanas commented Jul 12, 2023

OK, if it's just 4 rules, never mind.

pygments/lexers/bqn.py Outdated Show resolved Hide resolved
pygments/lexers/bqn.py Outdated Show resolved Hide resolved
pygments/lexers/bqn.py Show resolved Hide resolved
pygments/lexers/bqn.py Outdated Show resolved Hide resolved
@mutable-learning
Copy link
Contributor Author

mutable-learning commented Jul 13, 2023

All required changes have been committed but I am not sure about the mime-types, as this doesn't really apply to BQN. Thanks for your help @jeanas.

Copy link
Contributor Author

@mutable-learning mutable-learning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are now completed for this PR

@jeanas jeanas merged commit 9ac1241 into pygments:master Jul 18, 2023
15 checks passed
@Anteru Anteru added this to the 2.16.0 milestone Aug 5, 2023
@Anteru Anteru added the A-lexing area: changes to individual lexers label Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants