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

BUG: <foo>[0:] is not working #87

Open
joszamama opened this issue Nov 29, 2024 · 3 comments
Open

BUG: <foo>[0:] is not working #87

joszamama opened this issue Nov 29, 2024 · 3 comments
Assignees
Labels
prio: high High priority issue scope: bug Something isn't working

Comments

@joszamama
Copy link
Collaborator

No description provided.

@joszamama joszamama self-assigned this Nov 29, 2024
@joszamama joszamama added the scope: bug Something isn't working label Nov 29, 2024
@andreas-zeller
Copy link
Collaborator

See also #88. Slices, as in [0:], may have a lower priority at this point, but we should have a more reasonable error message.

@joszamama
Copy link
Collaborator Author

joszamama commented Nov 29, 2024

I am testing this problem currently, and it does not crash, but fandango is unable to find a solution. See this example:

Grammar:

<start> ::= <int> <int> ;
<int> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;

str(<start>[0:]) == "6" ;

After running FANDANGO for 100 iterations, we are unable to find a solution, but there is no crash. Also, I have checked manually, and the input "66" (which in this case, should be the solution) has a fitness of 0. The problem is not in the parser itself but in the constraint handling. I will keep working on this problem.

@joszamama joszamama assigned smythi93 and unassigned joszamama Nov 29, 2024
@andreas-zeller
Copy link
Collaborator

andreas-zeller commented Nov 29, 2024

The question is what <start>[N:] should be returning - but neither option can be "6". <start>[N:] could be

  1. A list of all its children (since <start>[0], <start>[1], etc. would return the 1st, 2nd, ... child). Then, <start>[0:] would return a list of [<int>, <int>] whose string representation would be, say, "[6, 6]".
  2. A string representation of the first characters starting at position N (since we treat symbols such as <start> as a string in other contexts). Then, <start>[0:] would return, say, "66".

I think the interpretation (1) is more in line with Python expectations (if we indeed make <start>[N] return the n-th child as a tree, which I'd recommend).

@joszamama joszamama added status: help wanted Task requires extra attention prio: high High priority issue and removed status: help wanted Task requires extra attention labels Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: high High priority issue scope: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants