Mealy machines are a better model of lexical analyzers

Wuu Yang*

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

5 Scopus citations

Abstract

Lexical analyzers partition input characters into tokens. When ambiguities arise during lexical analysis, the longest-match rule is generally adopted to resolve the ambiguities. The longest-match rule causes the look-ahead problem in traditional lexical analyzers, which are based on Moore machines. In Moore machines, output tokens are associated with states of the automata. By contrast, because Mealy machines associate output tokens with state transitions, the look-ahead behaviors can be encoded in their state transition tables. Therefore, we believe that lexical analyzers should be based on Mealy machines, rather than Moore machines, in order to solve the look-ahead problem. We propose techniques to construct Mealy machines from regular expressions and to perform sequential and data-parallel lexical analysis with these Mealy machines.

Original languageEnglish
Pages (from-to)27-38
Number of pages12
JournalComputer Languages
Volume22
Issue number1
DOIs
StatePublished - Apr 1996

Keywords

  • Automata
  • Finite-lookahead automata
  • Lexical analysis
  • Mealy machines
  • Moore-machines
  • Parallel algorithms
  • Regular expressions
  • Suffix automata

Fingerprint

Dive into the research topics of 'Mealy machines are a better model of lexical analyzers'. Together they form a unique fingerprint.

Cite this