DEV Community

Discussion on: 100 Languages Speedrun: Episode 75: Abstract Syntax Trees with Python ANTLR 4

Collapse
 
marcellourbani profile image
Marcello Urbani

Ever tried parser combinators? I guess in the end they're still recursive descend parsers but they don't feel like it

See an example here

Collapse
 
taw profile image
Tomasz Wegrzanowski
Collapse
 
marcellourbani profile image
Marcello Urbani

yep. I think they work better with languages with custom infix operators though

Thread Thread
 
taw profile image
Tomasz Wegrzanowski

Haskell desperately needs more operators because you can't reuse normal infix operators due to lack of polymorphism in Haskell.
Python parsec just reuses +, |, <<, >> etc. Example here.

The only time I really needed more operators was with Ruby Z3.

Thread Thread
 
marcellourbani profile image
Marcello Urbani

Not really. All those operators work on extremely polimorphic typeclasses like Monoid,Applicative or Alternative