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

Draft: Add lexer for Mojo language #1995

Closed
wants to merge 7 commits into from
Closed

Conversation

fnands
Copy link

@fnands fnands commented Sep 20, 2023

This is a (first draft) of a lexer for the Mojo programming language.

In principle, Mojo aims to be a superset of Python, so the Mojo lexer inherits from the Python lexer (thanks to @jneen for the suggestion).

I've never written a line of Ruby in my life, so if anything below looks suspect, that's why.

Currently a little stuck on regexes (trying to get to match outer square brackets in function definitions).
Any pointers appreciated.

@fnands fnands marked this pull request as draft September 21, 2023 13:28
@fnands
Copy link
Author

fnands commented Oct 25, 2023

I think I've narrowed it down to the fact that Mojo has parameters as well as functions.
So where a python function might look like:

def python_func(arg1, arg2):
    pass

a Mojo function could also have parameters in square brackets:

def mojo_func[param1, param2](arg1, arg2):
    pass

and the regexes don't deal with the parameters yet.

@fnands fnands closed this by deleting the head repository May 7, 2024
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

Successfully merging this pull request may close these issues.

None yet

1 participant