sirthias / parboiled2

A macro-based PEG parser generator for Scala 2.10+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scala 3: very slow / hanging rule compilation for `~` chaining subrules

jrudolph opened this issue · comments

As reported by @hughsimpson in akka/akka-http#4079 (comment):

found that if there were more than two non-literal subrules in a parser chained with ~ it basically takes forever to compile, unless you force right-associativity with parentheses (i.e. ip-number ~ ('.' ~ (ip-number ~ ('.' ~ ip-number))) compiles fast enough, but ip-number ~ '.' ~ ip-number ~ '.' ~ ip-number basically takes forever).

See akka/akka-http#4097 (comment):

it looks I've found the core reason of the problem with TailSwitch scala/scala3#14903

From looking at scala/scala3#14903 it looks like this problem can (or "is" or "will be") fixed on the Scala 3 compiler side and can be closed here...