Code Monkey home page Code Monkey logo

Comments (5)

ltratt avatar ltratt commented on May 22, 2024 1

If I try this in lrpar/examples/calc_actions I get:

>>> 1 + * ( 1 + ) ( + * 1 + 1 * ) ( * 1 )
Parsing error at line 1 column 5. Repair sequences found:
   1: Delete *
   2: Insert INT
Parsing error at line 1 column 13. Repair sequences found:
   1: Delete ), Shift (, Delete +, Delete *
   2: Delete ), Shift (, Insert INT, Delete +
   3: Insert INT, Shift ), Delete (, Delete +
   4: Delete ), Shift (, Insert INT, Shift +, Insert INT
   5: Insert INT, Shift ), Delete (, Shift +, Delete *
   6: Insert INT, Shift ), Delete (, Shift +, Insert INT
   7: Delete ), Shift (, Insert INT, Shift +, Delete *
Parsing error at line 1 column 29. Repair sequences found:
   1: Insert INT, Shift ), Delete (
   2: Delete ), Shift (, Insert INT
<evaluation aborted>

as you do. If I then follow its suggestions (noting that "Insert INT" means "insert a value of type INT" so I'll use 2 as an example) I get:

>>> 1 + ( 1 + ( 1 + 1 * 2 ) * 1 )  
Result: 5

which looks OK to me.

I guess it's the "insert INT" bit that causes you to make an input that can't be parsed? There is a UI issue here: sometimes we refer to lexeme values (e.g. Delete )) and sometimes lexeme types (e.g. Insert INT). I flapped around a bit on this originally because there's not an easy way in plain text to make clear that e.g. Insert ''' means "Insert a single quote".

The user can use the %epp feature to make the difference between these clearer though, perhaps, it would be better if the default was something like Insert <INT>. That would solve the "single quote" (and related problem), and I think the angle bracket problem is less of an issue.

from grmtools.

duskybomb avatar duskybomb commented on May 22, 2024

Thank you for such an elaborate response. I don't know how did I miss that this was due to inserting INT and not an syntactic error. Extremely sorry for that!

However, I have come across the repaired program not conforming to grammar issue with one of the repairs being:

1 + ( 1 + ( INT + INT * 1 + 1 * ( * 1 )
Input program: 1 + * ( 1 + ) ( + * 1 + 1 * ) ( * 1 )
If I follow the repair sequence: 1, 4, 2 from the one mentioned in my first post.

1: Delete *
4: Delete ), Shift (, Insert INT, Shift +, Insert INT
2: Delete ), Shift (, Insert INT

I hope this isn't another silly mistake from my side.

from grmtools.

duskybomb avatar duskybomb commented on May 22, 2024

If I use the %epp feature and mention %epp INT "1", I still get the <evaluation aborted> message. Is it because of timeout or something else?

from grmtools.

ltratt avatar ltratt commented on May 22, 2024

Ah, you can't intermix repair sequences in that way: depending on which repair sequence you take, the rest of the parse (and the parse errors) can be different. There's no practical way around this, unfortunately, without hitting a combinatorial explosion.

from grmtools.

duskybomb avatar duskybomb commented on May 22, 2024

Thank you for the clarification!

from grmtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.