Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Recursive descent parser implementation

Current License: CC BY-SA 4.0

8 events
when toggle format what by license comment
S Oct 28, 2023 at 12:49 history suggested Community Bot CC BY-SA 4.0
fix broken link (and actually link to the parsing slides PDF)
Oct 22, 2023 at 17:56 review Suggested edits
S Oct 28, 2023 at 12:49
Mar 8, 2017 at 14:31 comment added ollydbg23 @KristopherMicinski the next_token() function in if (next_token() == '+') and in next_token(); // advance to the next token in the stream are different, right? The first next_token means peek a token in the token queue, and the second next_token means advance_token, which means remove the peeked token from the token queue, and set a new value for the peeked token. Sometimes, I think the word "next" is confusing, because, in Hunter McMillen's answer, this just means the "CurrentToken", and in ccoakley's answer, this means the "peeked token", right?
Mar 22, 2012 at 1:13 comment added Kristopher Micinski Right, this exactly corresponds to the case in a functional language where you do processing, and then postprocessing using a tail recursive function. You can also implement them all at once by playing a little trick, which allows you to get the leftmost derivation with a tail recursive parser. drdobbs.com/cpp/184406384?pgno=1 This is the technique I mentioned in my post. (Morally it's fairly similar...)
Mar 22, 2012 at 1:07 comment added Hunter McMillen YACC and Bison are your friends I agree. When I was learning this stuff we encountered that same problem with parsing arithmetic as you mention above, our professor created a really elegant solution using the Visitor pattern.
Mar 22, 2012 at 1:03 comment added Kristopher Micinski @HunterMcMillen, exactly true, and this gets done, but it's a nasty hack for more complicated structures at times, and having to do it instead when you can use a parser generator instead is often proffered.
Mar 22, 2012 at 0:54 comment added Hunter McMillen You can use recursive descent to generate a parse tree, then change the order of traversal to process arithmetic.
Mar 22, 2012 at 0:10 history answered Kristopher Micinski CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /