Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Optimizing Parser Combinators

343 views

Published on

Presentation of IWST16, Prag

Video: https://youtu.be/wI5g1RN4cF8

Published in: Software
  • Video: https://youtu.be/wI5g1RN4cF8
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Optimizing Parser Combinators

  1. 1. 1 PetitParser Compiler Jan Kurš & Jan Vraný Mohammad Ghafari, Mircea Lungu and Oscar Nierstrasz
  2. 2. 2
  3. 3. 3 Parsing Contexts Bounded Seas Furthest Failure Layout- senstivity
  4. 4. 4
  5. 5. 5
  6. 6. 6 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  7. 7. 7 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  8. 8. 8 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  9. 9. 9 id ← #letter #word* expr ← term / ‘(‘ expr ‘)’ / …
  10. 10. 10 id ← #letter #word* expr ← term / ‘(‘ expr ‘)’ / …
  11. 11. 11 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  12. 12. 12 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  13. 13. 13 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  14. 14. 14 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  15. 15. 15 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  16. 16. 16
  17. 17. 17 id ← #letter #word* block ← #INDENT expr / block / … #DEDENT expr ← term / ‘(‘ expr ‘)’ / …
  18. 18. 18 PetitParser Compiler
  19. 19. 19 10k methods of Pharo code 3 parsers Compared to Compiled PetitParser Speedup
  20. 20. 20 PetitParser SmaCC RBParser 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
  21. 21. 21 Expressions Python Smalltalk Java Ruby 0 2 4 6 8 10 12 14
  22. 22. 22 PetitParser SmaCC RBParser 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 Compiler
  23. 23. 23 map: Plus program Token classToken Token idToken Sequence body Action class Sequence identifier Sequence ClassNode new   id: idToken value   body: body  CharClass #letter Choice letterOrDigit CharClass #digit Star … Indent indent Star Dedent dedent Choice Action method …
  24. 24. 24 0 0.2 0.4 0.6 0.8 1 1.2 Time[microseconds] Time per Character of Smalltalk Compiled Parser GC time

×