Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Grammar a BNF like Ruby DSL Parsing 960x368 by: Eric Mahurin Help us caption & translate this video! http://amara.org/v/G13L/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
The video titled "Grammar a BNF Like Ruby DSL Parsing" presented by Eric Mahurin at the LoneStarRuby Conf 2008 explores the development of a Domain Specific Language (DSL) for parsing using Ruby. Mahurin reflects on his journey from hand-crafted recursive descent parsers to creating a unified parser generator that combines lexer and parser functionality. This innovative approach allows developers to define grammars directly in Ruby instead of relying on separate BNF files. Key points discussed include: - **Historical Context**: Mahurin shares his experiences with different parser generators, specifically ANTLR and traditional tools like Racc and Yacc, emphasizing the need for a unified solution. - **Grammar Construction**: A grammar in this DSL is represented as Ruby objects, built piece by piece using Ruby operators and methods, allowing for dynamic language parsing. - **Parsing Mechanism**: The parsing process takes input that resembles a stream, utilizing grammar definitions to produce a sequence of outputs rather than traditional abstract syntax trees. - **Input Handling**: A method called `brackets` retrieves the next item from the input stream, enabling comparisons between the pattern and the tokens or characters. - **Error Handling & Recursion**: The parser is designed to handle left recursion effectively, enabling grammars to be defined in a more natural and straightforward manner. Mahurin illustrates this with examples such as parsing digits and handling nested parentheses. - **Output Options**: The system allows for flexible outputs, supporting different methods for evaluating mathematical expressions and adjusting output to meet user needs. - **Performance Considerations**: Mahurin discusses optimizations made to avoid excessive recursion and manage large input streams efficiently. - **Dynamic Code Generation**: The grammar engine generates code dynamically, supporting a variety of engines including one that compiles to C for improved performance. In conclusion, Mahurin's presentation delves into the innovative design of a Ruby-based DSL for parsing, highlighting the flexibilities of grammar construction, error handling, and performance optimization. He emphasizes the potential for further exploration and invites questions from the audience.
Suggest modifications
Cancel