Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected NFA #6208

Open
p6rt opened this issue Apr 24, 2017 · 4 comments
Open

unexpected NFA #6208

p6rt opened this issue Apr 24, 2017 · 4 comments
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules regression Issue did not exist previously

Comments

@p6rt
Copy link

p6rt commented Apr 24, 2017

Migrated from rt.perl.org#131207 (status was 'open')

Searchable as RT131207$

@p6rt
Copy link
Author

p6rt commented Apr 24, 2017

From @grondilu

$ uname -a
Linux stretch 4.9.0-2-686-pae #​1 SMP Debian 4.9.18-1 (2017-03-30) i686 GNU/Linux
$ perl6 --version
This is Rakudo version 2017.04.2-22-g9ed89d947 built on MoarVM version 2017.04
implementing Perl 6.c.
$ cat test.p6
say grammar {
  rule TOP { <foo> | <bar> }
  rule foo { foo ** 2..* % \, }
  rule bar { bar }
}.parse​: "foo,foo"
$ perl6 test.p6
Invalid to edge 0 in NFA statelist
  in regex TOP at test.p6 line 2
  in block <unit> at test.p6 line 1

@p6rt
Copy link
Author

p6rt commented Apr 24, 2017

From @AlexDaniel

This is actually a regression. The code makes sense (more or less), I can't see why would it error out like this.

Bisectable points to (2017-01-31) rakudo/rakudo@9ed4449

On 2017-04-24 15​:52​:55, grondilu@​yahoo.fr wrote​:

$ uname -a
Linux stretch 4.9.0-2-686-pae #​1 SMP Debian 4.9.18-1 (2017-03-30) i686
GNU/Linux
$ perl6 --version
This is Rakudo version 2017.04.2-22-g9ed89d947 built on MoarVM version
2017.04
implementing Perl 6.c.
$ cat test.p6
say grammar {
rule TOP { <foo> | <bar> }
rule foo { foo ** 2..* % \, }
rule bar { bar }
}.parse​: "foo,foo"
$ perl6 test.p6
Invalid to edge 0 in NFA statelist
in regex TOP at test.p6 line 2
in block <unit> at test.p6 line 1

@p6rt
Copy link
Author

p6rt commented Apr 24, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

From @jnthn

On Mon, 24 Apr 2017 16​:01​:19 -0700, alex.jakimenko@​gmail.com wrote​:

This is actually a regression. The code makes sense (more or less), I
can't see
why would it error out like this.

Bisectable points to (2017-01-31)
rakudo/rakudo@9ed4449

If it worked before, then it was by luck. The extra sanity check added in MoarVM that produces this message prevented a mis-generated NFA from causing the VM to read junk memory. In some cases, that led to a SEGV.

Anyway, the fix will be to figure out where in the NFA generator we are mis-generating things. That ain't the easiest thing to debug, but I will try and take a look at it soon, if I'm not beaten to it. The relevant code is in the NQP repository, under src/QRegex/NFA.nqp.

/jnthn

@p6rt p6rt added regex Regular expressions, pattern matching, user-defined grammars, tokens and rules regression Issue did not exist previously labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules regression Issue did not exist previously
Projects
None yet
Development

No branches or pull requests

1 participant