STKLOS-GENLEX(1)

NAMEan
stklos-genlex - lexical analyzer generation for STklos

SYNOPSIS
stklos-genlex lex-file output-file constructor

DESCRIPTION
The stklos-genlex can be used to make lexical analyzers with STklos. It is a simple front-end to the Danny Dubé SILex tool. This command always takes three parameters which are described below:

lex-file
    is the input file which contains the lex-like rules describing the analyzer to be built

output-file
    is a file which will contain the Scheme analyzer produced by the SILex tool.

constructor
    is the name of the procedure that will be produced in the output-file . This procedure takes one parameter which is the file name (or the port) which is used as the input stream for the lexical analyzer. The value returned by this procedure is a STklos object which contains the automaton. To fetch the next token of the input stream, programs must use the lexer-next-token. procedure. See the example below for details.

EXAMPLE
Suppose that the lexical rules are in the file rules.l. One can built an analyzer in the file out.stkfor this rules using the following command
     stklos-genlex  rules.l out.stk my-make-lex
The following piece of code show how to use the produced analyzer.
      (load "out.stk")
      ...
      (let ((lex (my-make-lex "foo")))
	;; Display the first token of file foo
	(display (lexer-next-token lex))
	...)

SEE ALSO
stklos(1) lex(1) and the SILex documentation