Skip to content

Simplify AST structure (ES5) #43

@philipnilsson

Description

@philipnilsson

One idea after using this lib for a bit: How do you guys feel about changing the AST to get rid of the Infix/Assign/Pre/Postfix data types and inlining them directly into the expression data type? E.g. change

  InfixExpr a InfixOp (Expression a) (Expression a) 

to

Add a (Expression a) (Expression a)
Sub a (Expression a) (Expression a)
...

this would lead to simpler code (at least for my usage, and I believe also in the internal parser implementation), and if you do want to match on an e.g. infix operator we could provide view patterns...

I realize this probably would introduce major breakage in any existing clients, if anyone would be looking to upgrade es3 -> es5 (is this currently possible?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions