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

Make regexes a slang #231

Open
masak opened this issue May 28, 2017 · 3 comments
Open

Make regexes a slang #231

masak opened this issue May 28, 2017 · 3 comments

Comments

@masak
Copy link
Owner

masak commented May 28, 2017

Regexes stand out to me as the slang: a special-purpose DSL within 007/Perl 6 for matching strings. With its own closed universe of Q nodes and its own execution semantics (backtracking). Furthermore, values enter and values leave. It screams slang.

Because of that, I think it'd be good for us to make it a slang early, simply because it's the most obvious one. Use cases that are helpful to the regex slang are likely to be helpful to other slangs too.

@vendethiel
Copy link
Collaborator

How can we make is parsed work if it is a slang?

@masak
Copy link
Owner Author

masak commented May 29, 2017

How can we make is parsed work if it is a slang?

I figure it'd still need to come pre-loaded with the default 007. That's not a big problem; I mainly want to explore as soon as possible how we can make slangs support the needs of the regex syntax.

@masak
Copy link
Owner Author

masak commented Jun 24, 2018

Coming back to this issue, the work I'm doing right now on #293 has made me realize how "there's not just one parser"; what we thought of as the OpScope abstraction is actually the parser's current repertiore of statements, operators, etc in all the different categories. Instead of OpScopes forming a stack that follows the program's block structure, we'll have parsers forming that stack.

Usually, two parsers adjacent on the stack will either be equivalent, or differ only in a few extra definitions. But a slang distinguishes itself by bringing in a fresh parser from somewhere else with its own ruleset. Evolution vs revolution.

(Of course, slangs also want to "escape" back out into their "parent parser", at which point things work very much like in the non-slangy case — except instead of parsers stacking (A)(A'), the slang's parser is sandwiched in the middle: (A)(B)(A').)

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

No branches or pull requests

2 participants