Abstract LR-parsing

  • Authors:
  • Kyung-Goo Doh;Hyunha Kim;David A. Schmidt

  • Affiliations:
  • Hanyang University, Ansan, South Korea;Hanyang University, Ansan, South Korea;Kansas State University, Manhattan, Kansas

  • Venue:
  • Formal modeling
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

We explain and illustrate abstract parsing, a static-analysis technique based on abstract interpretation, LR-parsing, and partial evaluation for validating PHP-like scripts that generate HTML/XML-style documents. A validated script is guaranteed to generate documents that are well formed with respect to the document language's LR(k)- grammar. In this way, abstract parsing resembles compiler data-type checking: a validated script will "not go wrong" and output a malformed, dynamically generated document. After presenting abstract parsing for LR(k)-grammars, we handle these important extensions: (i) String-replacement operations are analyzed by composing the finite-state automaton defined by a string replacement with the finite-state control of the LR(k)-parser. (ii) Conditional-test expressions are implemented by filter automata, which are also composed with the parser's finite-state control. (iii) Dynamically supplied and potentially malicious user input is predicted by characterizing it with an LR(k)-grammar and analyzing the strings generated by the grammar. (iv) Synthesized-attribute grammars are employed to calculate the semantics of the dynamically generated documents.