Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UP Lecture 16

UP Lecture 16

Compilers
Midterm Review
(202403)

Javier Gonzalez-Sanchez

December 19, 2023
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Dr. Javier Gonzalez-Sanchez | Compilers | 3 jgs Keywords Language

    Analysis Lexical Input: Symbols Output: Words Syntax Input: Words Output: Sentences Semantic Input: Sentences Translate or Execute Virtual Machine
  2. Dr. Javier Gonzalez-Sanchez | Compilers | 5 jgs Exam 1

    | Review Draw a DFA/regular expression equivalent to the regular expression/DFA a* a+ = a a*
  3. Dr. Javier Gonzalez-Sanchez | Compilers | 6 jgs Exam 1

    | Review Draw a DFA equivalent to the regular expression email2 = character+ \. character+ @ character+ \. domain
  4. Dr. Javier Gonzalez-Sanchez | Compilers | 7 jgs Exam 1

    | Review § Which are the tokens that are defined? Provide examples of Words from Tokens A, B, C and Error
  5. Dr. Javier Gonzalez-Sanchez | Compilers | 9 jgs Exam 1

    | Review Create a grammar to validate well-written references: Byron Lahey, Audrey Girouard, Winslow Burleson, and Roel Vertegaal. 2011. Understanding the use of bend gestures in mobile devices with flexible electronic paper displays. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI '11). ACM, New York, NY, USA, 1303-1312.
  6. Dr. Javier Gonzalez-Sanchez | Compilers | 10 jgs Exam 1

    | Review Create a grammar to validate well-written references: Byron Lahey, Audrey Girouard, Winslow Burleson, and Roel Vertegaal. 2011. Understanding the use of bend gestures in mobile devices with flexible electronic paper displays. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI '11). ACM, New York, NY, USA, 1303-1312.
  7. Dr. Javier Gonzalez-Sanchez | Compilers | 11 jgs Exam 1

    | Review Non-terminals <AUTORS> <YEAR> <TITLE> <CONFERENCE> <PUBLISHER> <ADDRRESS> <PAGES> Terminals string number . , -
  8. Dr. Javier Gonzalez-Sanchez | Compilers | 12 jgs Exam 1

    | Review Rules (using BNF) <REFERENCE> à <AUTORS> à <YEAR> à <TITLE> à <CONFERENCE> à <PUBLISHER> à <ADDRRESS> à <PAGES> à
  9. Dr. Javier Gonzalez-Sanchez | Compilers | 14 jgs Exam 1

    | Review Rules (create syntax diagrams) <REFERENCE> à <AUTORS> à <YEAR> à <TITLE> à <CONFERENCE> à <PUBLISHER> à <ADDRRESS> à <PAGES> à
  10. Dr. Javier Gonzalez-Sanchez | Compilers | 16 jgs Exam 1

    | Review Create a derivation tree for this input Byron Lahey, Audrey Girouard, Winslow Burleson, and Roel Vertegaal. 2011. Understanding the use of bend gestures in mobile devices with flexible electronic paper displays. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI '11). ACM, New York, NY, USA, 1303-1312.
  11. jgs Javier Gonzalez-Sanchez | SER332 | Spring 2018 | 21

    <Comp> → <Mix>|<Mix><Num> | <Comp><Comp> <Mix> → <Elem> | ( <Comp> ) <Elem> → H|O|C|S|Na|Cl| ... <Num> → 1|2|3|4| ... H2 O C O2 (S O4 )3 Na Cl S O3 Grammar | Example
  12. jgs Javier Gonzalez-Sanchez | SER332 | Spring 2018 | 22

    C O 2 Comp → Term | Term Num | Comp Comp Term → Elem | ( Comp ) Elem → H|O|C|S|Na|Cl| ... Num → 1|2|3|4| … Comp ⇒ Comp Comp ⇒ Term Comp ⇒ Elem Comp ⇒ C Comp ⇒ C Term Num ⇒ C Elem Num ⇒ CO Num ⇒ CO2 Grammar | Derivation
  13. Dr. Javier Gonzalez-Sanchez | Compilers | 24 jgs Language (SQL)

    § select nombre, calificacion from estudiantes where id = 1; § insert into estudiantes (id, nombre, calificacion) values (10, ”Javier”, 90); § delete from table where calificacion = 90;
  14. Dr. Javier Gonzalez-Sanchez | Compilers | 25 jgs Token §

    In the SQL (as described before) which are the tokens included? § AFD for each of Token
  15. jgs Compilers Javier Gonzalez-Sanchez, Ph.D. [email protected] Spring 2024 Copyright. These

    slides can only be used as study material for the Compilers course at Universidad Panamericana. They cannot be distributed or used for another purpose.