Closed leostera closed 3 years ago
The following Erlang code:
A, B, C.
Should parse to the equivalent AST:
open Erlang.Std.Ast_helper Expr.sequence (Expr.ident (Name.var "A")) (Expr.sequence (Expr.ident (Name.var "B")) (Expr.ident (Name.var "C")))
So this looks like a degenerate case of let binding, where the expression A is bound to _. At the moment that's how this is being worked around, so _ = A, can be parsed, and is equivalent to A.
_
_ = A
A
There is definitely work to be done in ./src/erlang/erl_parser.mly, and for inspiration we can look at the way the OCaml language parser is written to handle them: https://github.com/ocaml/ocaml/blob/trunk/parsing/parser.mly#L2075-L2084
./src/erlang/erl_parser.mly
This is currently possible thanks to the tree-sitter-erlang grammar.
The following Erlang code:
Should parse to the equivalent AST:
So this looks like a degenerate case of let binding, where the expression A is bound to
_
. At the moment that's how this is being worked around, so_ = A
, can be parsed, and is equivalent toA
.There is definitely work to be done in
./src/erlang/erl_parser.mly
, and for inspiration we can look at the way the OCaml language parser is written to handle them: https://github.com/ocaml/ocaml/blob/trunk/parsing/parser.mly#L2075-L2084