class: center, middle # Other Parsing Methods _CMPU 331 - Compilers_ --- # Non-Canonical Parsers * Mix top-down and bottom-up parsing methods * Create fragments of parse trees, and combine them later * More flexible, can parse more different kinds of grammars * More complex, to implement and use --- # Parallel Parsers * Only beneficial on parsing tasks big enough to require more than a fraction of a second on a single processor * long input (millions of tokens), rare * large grammar (millions of rules), mainly linguistics * many inputs (millions of files), parse each file separately with an ordinary parser, may need library linking later * Multiple Serial Parsers: * split the input * run the parser on each segment of the input, in parallel * combine the parse results from the segments * downside: difficult to know where to split the input, segment may fail to parse or results may fail to combine (due to separated tokens) --- # Parallel Parsers * Process-Configuration Parsers * agent-oriented programming: each grammar production is an independent process that receives messages from other productions * messages are parse trees for segments of input * Example, the agent for _N_ receives messages from the agents for _A_, _B_, and _C_: > _N_ → _ABC_ --- # Context-Sensitive Grammars * In context-free grammars, each non-terminal is independent * In context-sensitive grammars, non-terminals may look at neighbors to determine what production rules are allowed * Allows for long-range correlations not possible in CFG * downside: can be difficult to understand, slow to parse, and cumbersome for semantic actions