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

Alpha keeps running despite Parser Error #259

Open
KillerLink opened this issue Jul 9, 2020 · 2 comments
Open

Alpha keeps running despite Parser Error #259

KillerLink opened this issue Jul 9, 2020 · 2 comments

Comments

@KillerLink
Copy link

The following shortened/crafted input that triggers a parser error as shown in picture below, but does not halt execution / attempt to solve the given problem when called with: java -jar alpha.jar -i parser_error.lp

%file: parser_error.lp
input_value(a).
output_value(a).

cycle_max_max(3).
cycle_max(0).
{ cycle_max(N+1) } :- cycle_max(N), cycle_max_max(M), N<M.
cycle_last(N) :- cycle(N), ~cycle(N+1).

value(Z,0) :- input_value(Z).

cycle(0).
{ cycle(N+1) } :- cycle(N), cycle_max(K), N<K.

:- not value(X,N), cycle_max(N), output_value(X).

image

Alpha version used was downloaded from: https://github.com/alpha-asp/Alpha/releases/download/v0.5.0/alpha.jar

@lorenzleutgeb
Copy link
Member

lorenzleutgeb commented Jul 9, 2020

I suspect that there's some error recovery going on here but Alpha does not communicate well enough what it is doing (that it was able to recover from the error). Maybe someone can take the time to understand the recovery mechanism and improve it. That code wasn't touched in 3 years. If you run into trouble I can also pick this issue up, but I'm busy with other things these days...

@AntoniusW
Copy link
Collaborator

Yes, what @lorenzleutgeb indicated seems to be the culprit. As far as I remember, what we do there is: first run the parser in a simplified mode that is faster but not guaranteed to parse all inputs successfully; if that fails, run the parser a second time in the slower mode correctly parsing all well-formed inputs. It seems that the ~ for strong negation (which is currently not supported by Alpha) trips the first parser run, but it can recover from there and hence won't trigger a second parsing run.
Since Alpha swallows all errors on the first parsing run, this does not halt execution of the solver. Probably the logic there needs some fixing (and the way how/what error listeners are given to Antlr).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants