Lab for Automated Reasoning and Analysis LARA

Lecturecise 03: Longest Match. Generating Lexical Analyzers

Slides: pptx, pdf

Key insights:

  • we follow the maximal munch rule: lexical analyzer should always eagerly accept the longest token that it can recognize from the current point
  • it is possible to automate the construction of lexical analyzers; the starting point of this construction is a conversion of regular expressions to deterministic automata
  • tools that automate this construction are part of compiler-compilers such as JavaCC

Hand-Written Scanner for While Language

Tools for Constructing Lexers

Compiler Construction Tools

Collection of Exercises

References

Background on regular languages and automata

 
cc12/lecturecise_03.txt · Last modified: 2012/09/25 23:11 by vkuncak