sascangen: simple sather scanner generator

basic useage

the input file consists any number of tokens and regular expressions of the form
Token ::= regular expression

sascangen will then generate to stdout a sather class which when given an a character iterator which conforms to $ELT{CHAR} will have an iterator scan!:INT which iterates over the tokens scanned from the $ELT{CHAR}. SCANNER has several user accessable members.

caveats/TODO

this release is of very alpha quality. it does not attempt to optimize the state table in any fashion. several more optimized interfaces (such as direct file lexing) could be implemented. the character and line number attributes should be optional somehow. even Ignore'd values are saved up in token. probably many bugs still exist. should create some sort of macro facility. does not work with unicode. generator speed could be improved dramatically.

special tokens

expressions

example

this is the input file used by sascangen itself

CharClass ::= '[' (('\\' _)|[^\]\n\r\\])+ ']'
String ::= "'" ( '\\' _ | [^\n\\\r'])+ "'"
String ::= '"' ( '\\' _ | [^\n\\\r"])+ '"'
Ignore ::= "--" [^\n] * 
Ignore ::= [ \n]+
Semicolon ::= ';'
LParen ::= '('
RParen ::= ')'
Star ::= '*'
Plus ::= '+'
Option ::= '?'
Equals ::= "::="
UnderScore ::= '_'
Ident ::= [A-Za-z_]+
Pipe ::= '|'

contact info

copyright

Copyright (c) 1999 John Meacham

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

The originator of this code may not be misrepresented, any derivative
works must be clearly marked as such.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.