|
sorry, I'll explain. Coco/R can't use this grammar. It's too "ambiguous" (it's not ambiguous though, it's just not LL(1) deterministic)
grammar<start>=productions;
productions= productions production | production;
production=identifier ["<" attributes ">"] "=" expressions ";";
expressions= expressions "|" expression | expression;
symbol = literal | regex | identifier |
"(" expressions ")" |
"[" expressions "]" |
"{" expressions "}";
expression = symbols;
symbols= symbol symbols |;
attributes= attributes "," attribute | attribute;
attribute= identifier ["=" attrval];
attrval= literal | integer | identifier;
literal = '"([^"\\]|\\.)*"';
regex = '\'([^\'\\]|\\.)*\'';
identifier= '[A-Z_a-z][\-0-9A-Z_a-z]*';
integer='\-?[0-9]+';
whitespace<hidden>= '[ \v\f\t\r\n]';
lineComment<hidden>= '//[^\n]*';
blockComment<hidden,blockEnd="*/">="/*";
And even if it did left factor, which it doesn't seem to, it doesn't have a mechanism for collapsing factored non-terminals in the resulting parse tree
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Quote: it's just not LL(1) I think it is the point!It is not context free...
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
The above grammar is context-free
A grammar can be context-free and not LL(1)
LL(k) grammars are of the CFG category, and all but one class ( LL(1)! ) are not LL(1)
My back of the napkin calculation puts that grammar at LL(2) (LL(k) for k=2 )
That's why it needed to be left-factored - to modify it to be LL(1) - my code does that.
normally that modifies the parse tree, but my code can do that transparently so the parse tree stays the same (no added non-terminal productions)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Ok, I think you know much more about this stuff than me. Please excuse the troubles
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
No worries. It's a real specialization.
The goal though, is clean grammars and clean parse trees + easy to use and efficient parsers.
So far, this does it all, and I've not gone past LL(1) in the actual parsing algorithm itself.
Trust me when I say, I think only one tool put out there *might* have done this before, and it wasn't a generator, just a parser.
And I can't be sure because it was commercial and they never told you what algo they used. They didn't have to because you could write whatever you want into it, like I did above - you didn't need to know. <--- and that's hard to achieve.
In fact, the attributed EBNF syntax I use was inspired by that tool - called Programmar. It's not around anymore, unfortunately.
Anyway, my tool gives you LL(1) without the hassle of LL(1)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
codewitch honey crisis wrote: I'm debating about monetizing it. It's brilliant. No! There's no greater glory than Github. Open source it.
/ravi
|
|
|
|
|
I feel you, but also I am poor (at least by my region's standards), and while I'm fine with that, also helping with the bills wouldn't hurt.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Trust me - attempting to monetize an idea will steal all available cycles from you and cause you to have to deal with suits, who are an unpleasant and ignorant lot at best. Getting your name on Github will send more lucrative job offers to you than you will know what to deal with. Plus, it's nigh impossible to monetize something as hardcore as you're working on. Who do you expect your customers will be? And will they see the same value as you do? History will reveal that the most lucrative software endeavors haven't been technically challenging probems, but just good business ideas implemented at the right time. There's no money in algorithms - just glory. And that opens the door to opportunities that could pay well.
Have you tried talking to somebody at Google or FB about your idea? If it's as interesting and novel as you say it is (and I'm not knocking your solution - just being honest), you may not have to worry about money for the rest of your career.
Good luck and Godspeed. I hope you get to publish a paper at ACM and get the visibility you deserve.
/ravi
|
|
|
|
|
I hear you but i think an expressive parser generator is something devs would want, if they need to parse a thing.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
OMG! This is just unbelievable!
Good luck with whatever you go with!
|
|
|
|
|
While I'm left ANTLR behind a few years, I remember it was declared as LL(*), and uses EBNF to define the grammar...
It doesn't mean you have nothing new under your hand, but it may be hard to monetize such thing - maybe better to improve ANTRL or such...
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018
|
|
|
|
|
ANTLR's grammar is ugly, and ANTLR is huge.
Also with ANTLR it's harder to shape parse trees than it is with my setup
The whole thing is just cleaner to use. You can easily shape the parse trees with EBNF since this has full support, and hides factored non-terminals. You can also collapse your own, so you can shape the parse tree that way as well.
It's so much easier than ANTLR
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
ANTLR IS! ugly and huge... agreed...
My point is that you may not able to sell yours as long ANTLR is free, despite being better...
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge". Stephen Hawking, 1942- 2018
|
|
|
|
|
That's true.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
Nice tune, always liked Santana!
I do all my own stunts, but never intentionally!
JaxCoder.com
|
|
|
|
|
Thank you Sir. Yep Santana is a good part of my life
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
|
This has been out for quite a while. On the same album Smooth with Rob Thomas[^]
I do all my own stunts, but never intentionally!
JaxCoder.com
|
|
|
|
|
Basically, have you ever run into something you think you solved that you thought you shouldn't be able to solve, and it was much easier than would think to the point where you're not sure if it works?
I hate that.
But for now I'm just going to pretend it all works.
woo I can seemingly parse any grammar I want with my little LL(1) parser/generator
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
nah, I'm always clever.
but there are plenty of days when I feel others around me are dumber than normal, so I often have to tone myself down.
Message Signature
(Click to edit ->)
|
|
|
|
|
In contrary, I feel stupid at first. I regularly get tasks that seem impossible to solve, but almost always manage to find a solution
|
|
|
|
|
codewitch honey crisis wrote: Basically, have you ever run into something you think you solved that you thought you shouldn't be able to solve, and it was much easier than would think to the point where you're not sure if it works? I know what I wrote, so I will have an idea on whether it works or no, and why. It happened a few times.
Whenever I start feeling clever, she reminds me that I cook chicken in a non-stick pan with lots of vegetable oil to prevent it from sticking. Call it a balance
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Fortunately it seems like I've been mostly spared this affliction so far.
Mostly.
|
|
|
|
|
Every time I go to QA.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|