Skip to content

Simplify grammar #22

@QuarticCat

Description

@QuarticCat

Here are some possible ergonomic improvements.

  1. Set active as default so that users only need to mark silent rules. And for silent rules, we can use some special character or naming style to make them clean.
  2. Combine lexer definitions and tokens. (implemented in unify lexical def and lexical token #56)
    1. To ensure all tokens are terminal, we only need to check if the reference graph is a DAG, and then inline all rules.
    2. To avoid generating extra lexers, we can delay the generation of lexers after the generation of parsers, and inline & generate lexers by need.
  3. Combine parser definitions and fixpoints. (implemented in Auto infer fixpoints #47)
    1. We may automatically infer fixpoints. A possible algorithm is to find cycles in the reference graph and then mark all vertices in cycles as fixpoints.
  4. Remove ~ (sequence operator). Instead of writing e1 ~ e2, we can simply write e1 e2.
  5. Ad-hoc lexical rule. For example, "(" ~ sexprs ~ ")".

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions