lex-slides - Contents Introduction Our grammar example The...

Info icon This preview shows pages 1–8. Sign up to view the full content.

Contents Introduction Our grammar example The Analysis Give me some code ! Questions Lexer, Parser and AST for the 42sh - November, 2nd 2011- Lexer, Parser and AST for the 42sh 1 / 29
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Contents Introduction Our grammar example The Analysis Give me some code ! Questions Licence Copyright c 2011 Assistants < [email protected] > This document is for internal use only at EPITA < > . Copying is allowed only under these conditions: You must have downloaded your copy from the Assistants Intranet < > . You must make sure you have the latest version of this document. It is your responsibility to make sure that this document stays out of reach of students or individuals outside your class (your “promotion”). Lexer, Parser and AST for the 42sh 2 / 29
Image of page 2
Contents Introduction Our grammar example The Analysis Give me some code ! Questions 1 Introduction Lexical analysis Syntactic analysis The AST LL(1) Parser 2 Our grammar example 3 The Analysis The lexer job The parser job The AST 4 Give me some code ! The Lexer The AST structure The parser The AST evaluation 5 Questions Lexer, Parser and AST for the 42sh 3 / 29
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Contents Introduction Our grammar example The Analysis Give me some code ! Questions Outline 1 Introduction Lexical analysis Syntactic analysis The AST LL(1) Parser 2 Our grammar example 3 The Analysis The lexer job The parser job The AST 4 Give me some code ! The Lexer The AST structure The parser The AST evaluation 5 Questions Lexer, Parser and AST for the 42sh 4 / 29
Image of page 4
Contents Introduction Our grammar example The Analysis Give me some code ! Questions Lexical analysis The Lexer Lexer’s functions are: To transform the input (file, strings or standard input) into a token stream. To interact with the parser by sending it tokens. And nothing more! Lexer, Parser and AST for the 42sh 5 / 29
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Contents Introduction Our grammar example The Analysis Give me some code ! Questions Syntactic analysis The parser Parser’s functions are: To verify that its input syntax is valid according to a particular grammar. To extract the input syntactic structure. There are many parser types: LR bottom-up parsing, difficult to write by hand, usually generated by tools, LL top-down parsing, easier to write, but may not be suitable for all grammars, LALR LR(0) with a parser state. Lexer, Parser and AST for the 42sh 6 / 29
Image of page 6
Contents Introduction Our grammar example The Analysis Give me some code ! Questions The AST The AST The Abstract Syntax Tree is: A tree that represents the input according to a specific grammar useful for multiple operations on the same input Easier to implement using object oriented languages Lexer, Parser and AST for the 42sh 7 / 29
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 8
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '15
  • Grammar example

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern