Course Hero Logo

Class notes-01-24-2019.pdf - We are at the first step of...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 3 pages.

We are at the first step of compiler: lexical analysisSource program (a text file, list of characters). Lexical analysis will pick up wordsHow to actually process the regular expressions?: finite automataLexer uses regular expressions for stream of characters to tokens conversion.Quick Refresher (Automata)In automatas, we have only one starting state, which is pointed by an arrowstate machines are very common in video games. For example in Doom’s source code, youcould see the state machine implementation for animationIt literally implements a state machine for each of the objects in the gameFor example: if you are in this state, and, if this happens, go to this stateanimation can be in different states, so the program literally program a state machineIt has very practical rules, so this was why as a programmer it is useful for us.DFA: One state at a time, NFA: Possibly multiple states at a timeYou can always have multiple accepting states (both for DFA and NFA)Regular expressions, NFAs and DFAs are equally powerful.For the same language, you can have any of them.There is provably minimal DFA for a language, although you can have different DFAs torepresent the same language.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 3 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
hughes
Tags
Formal language, Regular expression

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture