Skip to content

Parsing expression grammars (PEG) support #169

Open

Description

@kant2002

Currently Yoakke chokes on large and complex expressions. The longer expression the more time Yoakke need to parse it.
I think somehow it should support PEG grammars.

[Rule("inclusive_OR_expression: inclusive_OR_expression '|' exclusive_OR_expression")]
private static ExpressionType MakeBitwiseOrExpression(ExpressionType a, ICToken @operator, ExpressionType b)

[Rule("logical_AND_expression: logical_AND_expression '&&' inclusive_OR_expression")]
private static ExpressionType MakeLogicalAndExpression(Expression a, ICToken @operator, ExpressionType b)

[Rule("inclusive_OR_expression: exclusive_OR_expression")]
[Rule("logical_AND_expression: inclusive_OR_expression")]
private static ExpressionType CreateExpressionIdentity(ExpressionType expression)

We know that this is some PEG over terminal exclusive_OR_expression. For trigger PEG encoding following conditions must be met.

  • Shared result type ExpressionType for expression rules (logical_AND_expression and inclusive_OR_expression) and expression terminal rules (exclusive_OR_expression).
  • All expression rules can be represented in form of other_expression_literal: expression_literal (...... terminals, expression terminals and another expression_literals)?
  • There should not(?) be recursive loops in the grammar descriptions.

Activity

  1. added
    enhancement
    on Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions