UpstandingHackers / hammer

Parser combinators for binary formats, in C. Yes, in C. What? Don't look at me like that.
GNU General Public License v2.0
430 stars 40 forks source link

GLR backend reaches unreachable code #184

Open abiggerhammer opened 7 years ago

abiggerhammer commented 7 years ago

Gary Berger reports that the following example, using the Python bindings, either segfaults or fails an assert with "unknown HCFChoice type":

import hammer as h

digit = h.ch_range('0', '9')
upper = h.ch_range('A', 'Z')
lower = h.ch_range('a', 'z')
chars = h.choice(digit, upper, lower)

chars.compile(h._PB_GLR)

Reproduces on OS X Sierra. The LL(k) and LALR backends have not exhibited this behavior yet. (I tried with Gary's example.)

pesco commented 7 years ago

Meredith L. Patterson on Tue, Jun 27 2017:



digit = h.ch_range('0', '9')
upper = h.ch_range('A', 'Z')
lower = h.ch_range('a', 'z')
chars = h.choice(digit, upper, lower)

chars.compile(h._PB_GLR)```

Reproduces on OS X Sierra. The LL(k) and LALR backends have not exhibited this behavior yet. (I tried with Gary's example.)

Is this specific to the Python binding or does it happen from C also?

abiggerhammer commented 7 years ago

I haven't checked yet (this landed while I was prepping a talk) but I can look this afternoon.

abiggerhammer commented 7 years ago

In preliminary investigation I'm not able to reproduce this without the Python bindings. I'll also try some of the other bindings that use SWIG, to see if I can narrow down the problem.