Your SlideShare is downloading. ×
0
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Tree Top
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Tree Top

1,040

Published on

Tree Top at RubyConfUy

Tree Top at RubyConfUy

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,040
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TreeTop (uy version) ++[>++[>++[>++[>++<-] <-] <-] <-] >>>><+++++[>+ +++++++++<-] >. <+++[>++++++<-] >+. <+++++++[>+ +<-] >. <+[>-<-] >-. <+++ [>---------------------------<-] >. <+++++++++++ ++++++++++++++++++++++++++++++[>++<-] >. <+++ [>--<-] >. <+++++++[>++<-] >. <+++++++++++++ [>------<-] >. <+++[>----<-] >. <+++++++++++++++ ++++++++++++++++++++++++++[>++<-] >+. <++[>--<-] >. <+++++++++++++[>------<-] >-. <+++++++[>+++++ +++++++<-] >. <+++[>----<-] >. <++[>++++++++<-] >. <+++++++++++[>--------<-] >. <+++++++[>++++++ ++++<-] >. <+++[>+++<-] >. <++[>+<-] >+. <++++++ +++++++++++++++++++++++++++++++++++[>--<-] >. <+ ++++++++++[>++++++<-] >+. <+++[>++++<-] >. <+[>-
  • 2. The glory
  • 3. DSL (embedded) Domain.specific do result.should be 2 end
  • 4. L? In order to write a language As a Ruby programmer I want to have an easy and powerful tool
  • 5. Write a lang? WTF? In fact, you do it all the time. Open files, parse stuff, turn it into strings, numbers, arrays and link it to code. Like when you wrote your first csv parser. (yeah, i know you did it...) You just didn’t had the right tool.
  • 6. BrainFuck 3000 slots 00 00 00 00 00 00 00 00 00
  • 7. BrainFuck ><+-.,[] 00 00 00 00 00 00 00 00 00
  • 8. BrainFuck >00 00 00 00 00 00 00 00 00
  • 9. BrainFuck <00 00 00 00 00 00 00 00 00
  • 10. BrainFuck +11 00 00 00 00 00 00 00 00
  • 11. BrainFuck -00 00 00 00 00 00 00 00 00
  • 12. BrainFuck , 00 00 00 00 00 00 00 00 00
  • 13. BrainFuck , 00 00 00 00 00 00 00 00 00 BB
  • 14. BrainFuck , 6666 00 00 00 00 00 00 00 00
  • 15. BrainFuck . 6666 00 00 00 00 00 00 00 00 BB
  • 16. BrainFuck [] 6666 00 00 00 00 00 00 00 00
  • 17. BrainFuck [>+] 6666 11 11 11 11 11 11 11 11 (now some live coding...)
  • 18. CFG Formally defined by Noam Chomsky in the 50s. (Yeah, that weird talking guy from the World Social Forum. For your info he is a great linguist.) LEX, Yacc Idea: Generates a language
  • 19. CFG ‘if(‘ exp ‘)’ stmt ‘else’ stmt | ‘if(’ exp ‘)’ stmt oror
  • 20. CFG // Wich alert will be executed? if(false) if(false) alert(“Don’t say ‘the second if alert’.”)else alert(“Say ‘the else alert’. Say it!!!”) ”) ”)
  • 21. CFG Gotcha!!! None. => undefined Generally, languages prefer to associate else to the nearest if. But this has to be made in a “meta” rule.
  • 22. Treetop treetop.rubyforge.org rubyconf2007.confreaks.com/d1t1p5_treetop.html Nathan Sobo (Pivotal Labs), Clifford Heath, Nick Kallen & more.
  • 23. PEG Parsing Expression Grammars Brian Ford paper 2004: http://pdos.csail.mit.edu/~baford/packrat/ Priorities, Not Ambiguities / (slash operator) (a / a b) is different of (a b / a) Syntactic Predicates (& and !) Regular Expression Like No left recursion. Idea: Recognizes a language
  • 24. PEG Result: - linear time parsing using memoization - one and only one valid parse tree - no dangling else cases - much easier to learn and use Drawbacks - still new - memory eater - not suitable for natural language processing
  • 25. PEG ‘if(‘ exp ‘)’ stmt ‘else’ stmt / ‘if(’ exp ‘)’ stmt priority operatorpriority operator
  • 26. Projects arithmetic + lambda calculus + sql gherkin (cucumber) mail (rails 3 standard) 0xCOFFEE (full lang compiled to LLVM) many more html, css, json, odp, scheme, apache conf, trxl, lolcode, brainfuck, sloc, hairball (haml), vcard, hapag, dcf, lordbishop (names)
  • 27. Beyond Compile with LLVM (look at 0xCOFFEE) Compile to Parrot? Implement Ruby? Watch Citrus
  • 28. Other langs Rats! Java PetitParser SmallTalk ppeg, pyPEG, pyparsing Python Perl6 rules Perl6 (native!) Frisby, Leafy Haskell
  • 29. CSV by the way le (line [n])* line end rule line (value ',')* value end rule value [^
  • 30. +++[>+++[>+++++++<-] <-] >><+++[>+++++ +<-] >. <+++[>++++++++++++<-] >. <++ [>--------<-] >. <+++++++[>++<-] >. <+[>+<-] >. <+++++[>--<-] >-. <+++[>++<-] >. <+[>-<-] >. <+ +[>++<-] >+. <+++++++++++++[>----<-] >. @joaomilho . mailee.me railer.im/chuck-norris

×