DISQUS

sean cribbs: Building a Parser-Generator in Erlang, Part 2 - sean cribbs :: digital renaissance man

  • Kevin Smith · 6 months ago
    I really like the way the library is evolving. Erlang's succinctness combined with HOFs makes for some very elegant code, IMHO.

    Have you thought about dropping the ?root term in your metagrammar? root(foo) looks cleaner and still allows you to use the parse transform.
  • Sean Cribbs · 6 months ago
    That portion is still in flux. I think that root() -> foo. would work too. Actually, there's no reason I couldn't omit the root declaration altogether and just use the first rule, but initally it was simpler to keep what that macro generates as a macro rather than insert an abstract form.
  • Robert Virding · 6 months ago
    Nice! But a bit unfair comment about comparing readability with the output of LALR generators as they are definitely not for human consumption. And yours was hand-written.
  • Sean Cribbs · 6 months ago
    Robert, that is true, but it is very helpful to have readable code when debugging a generated parser, as is the case with any code.