Comments (5)
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.
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.
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.
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.
Thank you for the clarification!
from grmtools.
Related Issues (20)
- Broken links for YACC and LEX Manual in grmtools-book HOT 5
- %ignore like in flex HOT 8
- Is it possible to perform side effects while parsing? HOT 3
- Would be nice to have an online playground HOT 8
- Order of execution of grammar statements? HOT 7
- Bug in grmtools documentation - traits not displaying required method names HOT 12
- Is there a way to avoid global variables for compile time data structures? HOT 5
- Request for example of handling string literals in lexer HOT 2
- error when using fake UMINUS token in %prec directive HOT 9
- GDB Support? HOT 5
- Add support for comments in lrlex files HOT 3
- Explain why Copy is required for a type specified %parse-param HOT 7
- Nondeterministic generation of Rust code HOT 2
- Support lex-style definitions HOT 1
- Trying to replicate `tinylang.yy` and `tinylang.l` syntax with `nimbleparse` HOT 5
- Weird that `nimbleparse` works on `java7.y` `java7.l` even though the `GT` symbol in both is different. HOT 1
- Online Yacc/Lex editor/tester HOT 6
- Detailed debug info for reduce/reduce shift/reduce errors? HOT 27
- Docs Question - Optional Prefix to Regular Expressions HOT 5
- lrpar lose info about debug HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grmtools.