Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 1351

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>2 The Gump Scanner Generator</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node1.html#chapter.intro">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node5.html#chapter.parser">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="chapter.scanner"><H1><A name="chapter.scanner">2 The Gump Scanner Generator</A></H1><P> <A name="label10"></A> This chapter describes the Gump Scanner Generator. Its input consists of an Oz source with embedded scanner specifications; the output implements each scanner by an Oz class. </P><DIV class="apropos"><P class="margin">Definitions</P><P> A <A name="label11"></A><EM>scanner</EM> is a program that performs lexical analysis, which means that it transforms a stream of characters into a stream of <EM class="noindex">tokens</EM><A name="label12"></A>. The text is read from left to right. During this process, sequences of characters are grouped into <A name="label13"></A><EM>lexemes</EM> according to user-defined rules, specified by so-called <A name="label14"></A><EM>regular expressions</EM> and associated <A name="label15"></A><EM>semantic actions</EM>. An action computes tokens from a lexeme, each consisting of a <EM class="noindex">token class</EM><A name="label16"></A> and an optional <EM class="noindex">token value</EM><A name="label17"></A>, which are appended to the token stream. The process is iterated until the end of the character stream is reached. </P></DIV><P> This chapter first describes the basic principles of the Gump Scanner Generator by means of an example in <A href="node3.html#section.scanner.example">Section&nbsp;2.1</A>. A more detailed reference is then given in <A href="node4.html#section.scanner.reference">Section&nbsp;2.2</A>. </P><HR><UL class="toc"><LI><A href="node3.html#section.scanner.example">2.1 Example</A><UL class="toc"><LI><A href="node3.html#label19">2.1.1 Writing a Scanner Specification</A></LI><LI><A href="node3.html#label50">2.1.2 Invoking Gump</A></LI><LI><A href="node3.html#label63">2.1.3 Using the Generated Scanner</A></LI></UL></LI></UL><UL class="toc"><LI><A href="node4.html#section.scanner.reference">2.2 Reference</A><UL class="toc"><LI><A href="node4.html#section.scanner.syntax">2.2.1 Syntax of the Scanner Specification Language</A><UL class="toc"><LI><A href="node4.html#label89">Syntax of Regular Expressions</A></LI><LI><A href="node4.html#label94">Ambiguities and Errors in the Rule Set</A></LI></UL></LI><LI><A href="node4.html#section.scanner.params">2.2.2 Parameters to Scanner Generation</A></LI><LI><A href="node4.html#section.scanner.class">2.2.3 The Mixin Class <CODE>GumpScanner<SPAN class="keyword">.</SPAN><SPAN class="string">'class'</SPAN></CODE></A></LI></UL></LI></UL></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node1.html#chapter.intro">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node5.html#chapter.parser">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~kornstae/">Leif&nbsp;Kornstaedt</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>