Click here to Skip to main content
15,895,483 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: For the dogs Pin
lopatir20-Feb-20 5:10
lopatir20-Feb-20 5:10 
GeneralRe: For the dogs Pin
dandy7220-Feb-20 6:05
dandy7220-Feb-20 6:05 
GeneralRe: For the dogs Pin
Marc Clifton20-Feb-20 5:35
mvaMarc Clifton20-Feb-20 5:35 
GeneralRe: For the dogs Pin
W Balboos, GHB20-Feb-20 5:03
W Balboos, GHB20-Feb-20 5:03 
NewsRe: For the dogs Pin
lopatir20-Feb-20 5:20
lopatir20-Feb-20 5:20 
QuestionRe: For the dogs Pin
lopatir20-Feb-20 5:45
lopatir20-Feb-20 5:45 
GeneralRe: For the dogs Pin
den2k8820-Feb-20 21:12
professionalden2k8820-Feb-20 21:12 
GeneralI'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 3:33
mvahoney the codewitch20-Feb-20 3:33 
I've got a coding problem that I don't know if there's a solution to and it's pretty important.
This isn't a coding question. It's more of a rant.

When a bottom up parser parses input it kind of does things backward.

You get your inputs into the queue:
1. term a
2. term b
3. non-term C
Then a reduce action with a rule
4. Reduce D-> a b C
which tells me to pop C, b, a, and then push D, effectively "replacing" the first 3 entries with 1 entry from step 4

This is all well and good, except when there's errors in the input

let's say there was an error parsing step 1 above - and the error recovery "ate" 2 and 3 leaving me with
1. error #ERROR

Well even if i figured out to reduce to D (which i probably wouldn't) I have the wrong number of items on the stack.

So my tree building fails.

I've tried inserting artificial tokens. I've tried rule rewriting, nothing works. I don't have enough information at any given point to reconstruct what's left of the tree. D'Oh! | :doh:

So I can do a pull parse on it, but the tree can't be generated from the input.
i get my info back with a class that works like XmlReader with the pull parser
but there's no way to generate a hierarchy for it because the tree is built from the leaves to the root, and a corrupt subtree will corrupt its parents due to the stack issue - and that's IF you don't wind up ending early by trying to pop from an empty stack!

Frown | :(

This is my life right now. I never did solve this problem last time I encountered it either.

EDIT: Woo I got it working somewhat
Real programmers use butterflies


modified 20-Feb-20 10:35am.

GeneralRe: I'm stumped and in the worst way. Pin
musefan20-Feb-20 3:55
musefan20-Feb-20 3:55 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 4:02
mvahoney the codewitch20-Feb-20 4:02 
GeneralRe: I'm stumped and in the worst way. Pin
Jörgen Andersson20-Feb-20 4:19
professionalJörgen Andersson20-Feb-20 4:19 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 4:29
mvahoney the codewitch20-Feb-20 4:29 
GeneralRe: I'm stumped and in the worst way. Pin
Jörgen Andersson20-Feb-20 4:38
professionalJörgen Andersson20-Feb-20 4:38 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 5:13
mvahoney the codewitch20-Feb-20 5:13 
GeneralRe: I'm stumped and in the worst way. Pin
Marc Clifton20-Feb-20 4:23
mvaMarc Clifton20-Feb-20 4:23 
GeneralRe: I'm stumped and in the worst way. Pin
  Forogar  20-Feb-20 4:26
professional  Forogar  20-Feb-20 4:26 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 4:30
mvahoney the codewitch20-Feb-20 4:30 
GeneralRe: I'm stumped and in the worst way. Pin
kalberts20-Feb-20 4:55
kalberts20-Feb-20 4:55 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 5:12
mvahoney the codewitch20-Feb-20 5:12 
GeneralRe: I'm stumped and in the worst way. Pin
User 1106097920-Feb-20 4:25
User 1106097920-Feb-20 4:25 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 4:31
mvahoney the codewitch20-Feb-20 4:31 
GeneralRe: I'm stumped and in the worst way. Pin
musefan20-Feb-20 4:47
musefan20-Feb-20 4:47 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 5:09
mvahoney the codewitch20-Feb-20 5:09 
GeneralRe: I'm stumped and in the worst way. Pin
Member 1298255820-Feb-20 4:19
Member 1298255820-Feb-20 4:19 
GeneralRe: I'm stumped and in the worst way. Pin
honey the codewitch20-Feb-20 4:33
mvahoney the codewitch20-Feb-20 4:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.