Rockit: A Parser Generator for Ruby

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    Rockit: A Parser Generator for Ruby - Presentation Transcript

    1. Rockit Jason Morrison Language Processors and Compiler Construction Winter 2006-3
    2. Ruby Rockit: Overview
      • It used to be GLR.
      • Maybe in the future it will be PEG.
      • It’s kind of there.
      • Let’s see!
    3. It used to be GLR
        • First home I found:
          • http://rockit.sourceforge.net/
        • Version 0.3.8, updated October 2001
        • What did it look like?
    4. Ruby Rockit: Overview
      • It used to be GLR.
      • Maybe in the future it will be PEG.
      • It’s kind of there.
      • Let’s see!
    5. Ruby Rockit: Overview
      • It used to be GLR.
        • What’s that?
      • Maybe in the future it will be PEG.
      • It’s kind of there.
      • Let’s see!
    6. What’s GLR?
        • Generalized LR
        • Parse tables have multiple transitions
        • When it hits S/R or R/R conflict:
          • Fork parse stack
          • Follow both paths
          • Got a rule that produces no transition? Discard that stack.
    7. How well does it work?
        • Run time scales with degree of nondeterminism.
        • O(n) on deterministic grammar.
        • Optimize: share common stack prefix/suffix. (Leads to a state lattice rather than stack)
    8. Ruby Rockit: Overview
      • It used to be GLR.
      • Maybe in the future it will be PEG.
      • It’s kind of there.
      • Let’s see!
    9. Maybe in the future it will be PEG.
        • Rockit 0.8.0
        • C-based parser, Ruby production rules
        • Unambiguous,  lookahead, O(n) Packrat parsing
        • Ruby and Java grammars, analyzers, pretty-printers
    10. Ruby Rockit: Overview
      • It used to be GLR.
      • Maybe in the future it will be PEG.
        • … PEG? Packrat?
      • It’s kind of there.
      • Let’s see!
    11. What’s PEG?
      • “Parsing Expression Grammar”
      • No separate tokenizing phase
      • Unambiguous (one tree for valid parse)
      • No left recursion (as with LL)
    12. What’s PEG?
      • Fixes “dangling else” via prioritization
      • Infinite lookahead via syntactic predicates
      • Let’s hear it from B ryan Ford (coined PEG)
      http://www.bford.info/pub/lang/peg-slides.pdf
    13. What’s Packrat?
      • Essentially: recursive descent
      • Memoization yields O(n) with unlimited lookahead and backtracking
      • Packrat parsers:
        • Java: Rats! (from xtc, eXTensible C project)
        • Haskell: Pappy
    14. Packrat: Since when?
      • Theory has been formalized since the 70s
      • Memoization was too heavy, then.
      • Now, RAM is cheap; memoization often consumes less than subsequent compilation steps.
    15. Ruby Rockit: Overview
      • It used to be GLR.
      • Maybe in the future it will be PEG.
      • It’s kind of there.
      • Let’s see!
    16. Ruby Rockit: Overview
      • It used to be GLR.
      • Maybe in the future it will be PEG.
      • It’s kind of there.
        • What do you mean by that?
      • Let’s see!
    17. Rockit 0.7.2
        • Newest available
        • Deemed 0.8.0 preview
        • Pure Ruby (=> slow) recursive-descent parser
        • Does not support syntactic predicates
        • Examples are only documentation
        • Unorganized source
        • No error hooks
    18. Ruby Rockit: Overview
      • It used to be GLR.
      • Maybe in the future it will be PEG.
      • It’s kind of there.
      • Let’s see!
        • Let’s see it anyways!
    19. Rockit 0.7.2
      • Arithmetic expression example
    20. Conclusion
      • 0.7.2 is interesting, but doesn’t have:
        • Syntactic predicates
        • Memoization
      • Still denotes grammar in code.
        • Pros: Quick, familiar.
        • Cons: Difficult to analyze.
      • If 0.8.0 is released as promised, should be great!
    21. Resources
      • These slides and I:
        • http:// jayunit.net/rockit
        • jason.p.morrison@gmail.com
      • PEG ML:
        • https:// lists.csail.mit.edu/mailman/listinfo/peg
      • Bryan Ford:
        • http:// pdos.csail.mit.edu/~baford/packrat
      • Wikipedia, Google for:
        • GLR parser, PEG grammar, Packrat parser

    Jason MorrisonJason Morrison, 2 years ago

    custom

    1977 views, 2 favs, 1 embeds more stats

    Discusses Rockit, a parser generator for the Ruby l more

    More Info

    © All Rights Reserved

    Go to text version
    • Total Views 1977
      • 1964 on SlideShare
      • 13 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 18
    Most viewed embeds
    • 13 views on http://jayunit.net

    more

    All embeds
    • 13 views on http://jayunit.net

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as innappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel

    Categories