|
I have two different parsers in my project that work using different algorithms (each with advantages and disadvantages) but they share a common grammar format.
The trouble is, with one of them I cannot honor all the features in the grammar, but with the other one I can. Hence, not quite a "common" grammar format.
Now here's the thing:
I can either:
a) move all of the tree shaping features off the pull reader and onto the parse tree (much less efficient but would support all types of parsers)
b) keep the feature in the pull reader that supports it and to hell with the inconsistency with the grammar.
I keep wanting to avoid option B because it's ugly, but I don't like option A either because it's less efficient and doesn't support the feature at the reader level.
What should I do?
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.
|
|
|
|
|
Go down the pub, have a good couple of stiff drinks, and wait for inspiration. Or arrest, kebab, hangover - whichever comes first.
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!
|
|
|
|
|
Rule one: don't do anything until your really truly absolutely sure.
Leave well enough alone.
And go down to the pub.
|
|
|
|
|
if it was well enough I would leave it alone.
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.
|
|
|
|
|
How many people have died so far?
|
|
|
|
|
does my inner child count?
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.
|
|
|
|
|
First, make sure it's really dead...
|
|
|
|
|
Do a Captain Kirk.
Adjust the parameters of the test. Redefine the "commonality" of the grammar format so they both work off the same set of grammar rules. Then just allow the one that does more to do more independently.
Tada!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
so basically, option be with extra steps.
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.
|
|
|
|
|
Yarp!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
honey the monster, codewitch wrote: What should I do? Do it all in the colour coding:
0. Green is for go/safety, unless your market is Asian, in which case it means a boy.
1. Red is for danger and "HOT! Don't Touch!", unless your market is Asian, in which case it means "Let's PARTAY!"
In a nutshell:
Horses : Courses
Never mind what you think/prefer/want; What do your users need?
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Either option fulfills the functional requirements. It's just *how*
I think I'm going to go with option A.
It's easier for me to implement, and more importantly it's easier for the users to use -sort of, there's a very minor wrinkle (small learning curve) but it replaces some worse wrinkles.
Also, there are certain tree shaping features i'd like to add that are only possible by doing tree shaping on the parse tree rather than the reader.
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.
|
|
|
|
|
You got me at:honey the monster, codewitch wrote: it's easier for the users to use
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
option C would be easier too, (both readers support tree shaping) but apparently I'm not smart enough to make that happen.
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.
|
|
|
|
|
Lift and separate it is then.
|
|
|
|
|
*sigh* i think so.
It's not the refactoring that bothers me. It's the capability downgrade on the LL(1) parser.
Oh well.
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.
|
|
|
|
|
I don't think I've ever coded anything as complicated as you appear to be doing - what is the end goal ( think before answering ) ?
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
Profit.
|
|
|
|
|
I don't think so with this guy
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
I'm creating a parser generator system. The reason it needs to shape trees is for the same reason ANTLR does - because raw parse trees universally suck and are bloated.
Most of the tree shaping involves getting rid of or collapsing sections of the 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.
|
|
|
|
|
Design some new fancy icons to go with the new Windows, Office and Visual Studio Code icons!
You shouldn't even be thinking about this stuff until you've got some nice icons
Or you could somehow abstract the two away behind an interface, if that's possible, keep both, and inject either A or B according to your needs.
Yes? No?
|
|
|
|
|
you sound like a manager. lol
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.
|
|
|
|
|
We need to phosfluorescently incept performance based bandwidth!
Also, I'm outsourcing your job to some lowly paid interns in India.
Ergo, you're fired!
|
|
|
|
|
|
I was left-handed until I went to school, at 5 years old. They made me write right-handed.
I could also read and write perfectly well (well, as well as five-year-olds' fingers allow), but they made me "unlearn" it all, because the ITA alphabet[^] was in vogue, at the time.
Essentially, one month of infant school set me back two or three years. At age 5.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|