4 ms·
> It's a matter of whether the children are resolved before the parents, or the parents are resolved before the children. Yep, and Narcissus resolves the paren
by Rusky 9y ago
> It's a matter of whether the children are resolved before the parents, or the parents are resolved before the children.
Yep, and Narcissus resolves the parents before the children by virtue of `Script` calling `Statements`, `Statements` calling `Statement`, etc. before ever actually seeing the bodies of their corresponding production rules.
A bottom-up parser doesn't work that way at all. Its states aren't determined by what they're about to parse, but by what has already been parsed. The `pushTarget` function in Narcissus is completely unrelated to bottom-up parsing.
- chubot 9y agoYeah I see what you mean. There is some stuff that doesn't look like a recursive descent parser to me, but that's probably because there are some JavaScript idioms and that's not my main language.
- BrendanEich 9y agoThe code you mentioned, pushTarget in particular, is for semantic checking, nothing to do with purely syntactic analysis AKA parsing. In particular, pushTarget is for break to label and continue to label (the "Target" is a labeled statement's exit or continue point).
- chubot 9y agoOK interesting, thanks. Yes that definitely could be part of my confusion -- that the code is doing more than parsing; it's also doing some semantic analysis in the same pass.