<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>Analyzer -- the class of all lexical analyzers</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_char__Analyzer.html">next</a> | <a href="index.html">previous</a> | <a href="___Parser.html">forward</a> | backward | <a href="index.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="a framework for building parsers">Parsing</a> > <a href="___Analyzer.html" title="the class of all lexical analyzers">Analyzer</a></div> <hr/> <div><h1>Analyzer -- the class of all lexical analyzers</h1> <div class="single"><h2>Description</h2> <div><p>A function that accepts input in its original form and separates it into tokens, will be called <span>a <a href="___Analyzer.html">lexical analyzer</a></span>. These analyzers are functional: call one with the original input, and it returns a function of 0 arguments (with changeable internal state) that keeps returning tokens each time it is called until none are left. Actually, the analyzer is to return a pair: <tt>(pos,token)</tt>, where <tt>pos</tt> is a string indicating the position where <tt>token</tt> was found in the input. A position will be a sort of thing which can be converted to string with <a href="../../Macaulay2Doc/html/_to__String.html" title="convert to a string">toString</a> (for printing error messages) and can be sorted.</p> </div> </div> <div class="waystouse"><h2>Methods that use a lexical analyzer :</h2> <ul><li><span><a href="___Parser_sp_co_sp__Analyzer.html" title="combine a parser with a lexical analyzer to make a complete system">Parser : Analyzer</a> -- combine a parser with a lexical analyzer to make a complete system</span></li> </ul> <h2>Fixed objects of class Analyzer :</h2> <ul><li><span><a href="_char__Analyzer.html" title="a lexical analyzer that provides characters from a string one at a time">charAnalyzer</a> -- a lexical analyzer that provides characters from a string one at a time</span></li> <li><span><a href="_nonspace__Analyzer.html" title="a lexical analyzer that provides non-white-space characters from a string one at a time">nonspaceAnalyzer</a> -- a lexical analyzer that provides non-white-space characters from a string one at a time</span></li> </ul> </div> <div class="waystouse"><h2>For the programmer</h2> <p>The object <a href="___Analyzer.html" title="the class of all lexical analyzers">Analyzer</a> is <span>a <a href="../../Macaulay2Doc/html/___Self__Initializing__Type.html">self initializing type</a></span>, with ancestor classes <a href="../../Macaulay2Doc/html/___Function__Closure.html" title="the class of all function closures">FunctionClosure</a> < <a href="../../Macaulay2Doc/html/___Function.html" title="the class of all functions">Function</a> < <a href="../../Macaulay2Doc/html/___Thing.html" title="the class of all things">Thing</a>.</p> </div> <div><h3>Menu</h3> <ul><li><span><a href="_char__Analyzer.html" title="a lexical analyzer that provides characters from a string one at a time">charAnalyzer</a> -- a lexical analyzer that provides characters from a string one at a time</span></li> <li><span><a href="_nonspace__Analyzer.html" title="a lexical analyzer that provides non-white-space characters from a string one at a time">nonspaceAnalyzer</a> -- a lexical analyzer that provides non-white-space characters from a string one at a time</span></li> </ul> </div> </div> </body> </html>