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

Known Parsing challenges? #6

Open
samuelgoto opened this issue Jul 11, 2017 · 0 comments
Open

Known Parsing challenges? #6

samuelgoto opened this issue Jul 11, 2017 · 0 comments

Comments

@samuelgoto
Copy link
Owner

(porting @Waldemar's comments into github issues)

@Waldemar: is it possible to avoid "cover grammars"? Is it possible to make a distinction between syntax expressions and type expressions? For example:

// How does a parser know whether "<" is a "less-than" token or a "open-generic" 
// token without looking ahead?
... a: b<c> ...
// Arrow functions introduced a similar challenge, take the following example:
... (a, b) ...
// One only knows whether that's a "parenthesis expression" -> 
// "comma expression" -> "variable reference" or
// "parameter list" -> "parameter" **after** seeing the token "=>".
// So that
... (a, b) => ....
// Is parsed differently than
... (a, b); ...
// And that introduces complexity in the parser as well as security challenges
// whitelisting programs.

@Waldemar used a term to describe grammars that saved the tokens in a "union"-like structure and that resolved the ambiguity at later stages of parsing ("cover grammar"?), as something to be avoided (e.g. leads to complexity and leads to security challenges whitelisting programs). He cited arrow functions (=>) as an example. Reach out to find what is the right term.

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