Click here to Skip to main content
15,894,825 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: I went down to the paint store to get thinner... Pin
Ron Anders20-Aug-19 15:53
Ron Anders20-Aug-19 15:53 
GeneralRe: I went down to the paint store to get thinner... Pin
Ravi Bhavnani20-Aug-19 17:11
professionalRavi Bhavnani20-Aug-19 17:11 
GeneralRe: I went down to the paint store to get thinner... Pin
Rajesh R Subramanian20-Aug-19 21:40
professionalRajesh R Subramanian20-Aug-19 21:40 
GeneralRe: I went down to the paint store to get thinner... Pin
Jacquers20-Aug-19 20:26
Jacquers20-Aug-19 20:26 
GeneralRe: I went down to the paint store to get thinner... Pin
Rajesh R Subramanian20-Aug-19 21:41
professionalRajesh R Subramanian20-Aug-19 21:41 
GeneralRe: I went down to the paint store to get thinner... Pin
megaadam20-Aug-19 21:58
professionalmegaadam20-Aug-19 21:58 
GeneralRe: I went down to the paint store to get thinner... Pin
CodeWraith20-Aug-19 23:22
CodeWraith20-Aug-19 23:22 
General*headdesk* *headdesk* *headdesk* Pin
honey the codewitch20-Aug-19 10:00
mvahoney the codewitch20-Aug-19 10:00 
An LR parser works like this

Fetch = tokenFoo
Fetch = tokenBar
Fetch = tokenBaz
// parser recognizes those three in a row so it reduces to a rule
Foobar -> tokenFoo tokenBar tokenBaz

You don't get the rule to reduce to until after the tokens are read. You have no idea how many tokens it takes to resolve a rule until after the fact. Which is fine. Usually.

So to build a tree, you have to keep a stack, push any tokens fetched, and then whenever you reduce to a rule, you pop the tokens on the right hand side of the rule, and push a new token for the left hand side of the rule. Easy.

The trouble is when an error is encountered. You won't necessarily get the right number of tokens back

(the parser can actually handle this part, but the tree builder can't)
Fetch = tokenFoo
Fetch = error
Reduce = FooBar -> tokenFoo error ???

Ouch. I don't have enough tokens.

The trouble is, I don't know I don't have enough tokens until the stack is empty.

So basically, I can't even build trees from a shift reduce/LR parser if there are errors in the input.

This is BAD.
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.

GeneralRe: *headdesk* *headdesk* *headdesk* Pin
Jörgen Andersson20-Aug-19 20:34
professionalJörgen Andersson20-Aug-19 20:34 
GeneralRe: *headdesk* *headdesk* *headdesk* Pin
honey the codewitch20-Aug-19 23:14
mvahoney the codewitch20-Aug-19 23:14 
GeneralRe: *headdesk* *headdesk* *headdesk* Pin
BillWoodruff21-Aug-19 5:15
professionalBillWoodruff21-Aug-19 5:15 
GeneralEstimating software like omelettes Pin
raddevus20-Aug-19 8:20
mvaraddevus20-Aug-19 8:20 
GeneralRe: Estimating software like omelettes Pin
Marc Clifton20-Aug-19 8:36
mvaMarc Clifton20-Aug-19 8:36 
GeneralRe: Estimating software like omelettes Pin
devenv.exe20-Aug-19 8:50
professionaldevenv.exe20-Aug-19 8:50 
GeneralRe: Estimating software like omelettes Pin
raddevus20-Aug-19 8:54
mvaraddevus20-Aug-19 8:54 
GeneralRe: Estimating software like omelettes Pin
BStorrar21-Aug-19 3:21
BStorrar21-Aug-19 3:21 
GeneralRe: Estimating software like omelettes Pin
dandy7220-Aug-19 8:53
dandy7220-Aug-19 8:53 
GeneralRe: Estimating software like omelettes Pin
raddevus20-Aug-19 8:57
mvaraddevus20-Aug-19 8:57 
GeneralRe: Estimating software like omelettes PinPopular
Gary R. Wheeler20-Aug-19 10:28
Gary R. Wheeler20-Aug-19 10:28 
GeneralRe: Estimating software like omelettes Pin
raddevus20-Aug-19 10:31
mvaraddevus20-Aug-19 10:31 
GeneralRe: Estimating software like omelettes Pin
Gary R. Wheeler20-Aug-19 10:49
Gary R. Wheeler20-Aug-19 10:49 
GeneralRe: Estimating software like omelettes Pin
raddevus20-Aug-19 10:54
mvaraddevus20-Aug-19 10:54 
GeneralRe: Estimating software like omelettes Pin
Gary R. Wheeler20-Aug-19 14:15
Gary R. Wheeler20-Aug-19 14:15 
GeneralRe: Estimating software like omelettes Pin
raddevus21-Aug-19 1:37
mvaraddevus21-Aug-19 1:37 
GeneralRe: Estimating software like omelettes Pin
Rajesh R Subramanian20-Aug-19 21:43
professionalRajesh R Subramanian20-Aug-19 21:43 

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.