{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Course mechanics mechanics ml variable bindings

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n their set. Winter 2013 UW CSE 401 (Michael Ringenburg) 16 8 1/14/13 Building a Scanner CSE341: Programming CSE341: Programming Languages Languages •  We’ve seen the theory (RE to NFA to DFA), but how is this converted to prac:ce? Lecture 1 Lecture 1 •  A scanner needs to take an Course Mechanics input stream and convert it to Course Mechanics tokens. ML Variable Bindings •  Mhe “longest match” principle –  Following tL Variable Bindings – i.e., build the longest legal token star:ng at the current input posi:on. Then repeat. Dan Grossman General idea: Dan Grossman Fall 2011 Fall oken –  Create an RE for every t2011 type. E.g., an RE for +, and RE for integers, etc. –  Build a DFA for the union of the REs –  Modify DFA implementa:on to recognize the longest matching substring (rather than only accep:ng the whole string). •  This is some:mes free/unnecessary for certain DFAs –  Repeatedly invoke (ty...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online