This is the alexa Reference Manual, version 2.1.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 03:14:08 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
alexa
A lexical analyzer generator.
Robert Smith <robert@rigetti.com>
BSD 3-clause (See LICENSE.txt)
2.1.1
alexandria
(system).
cl-ppcre
(system).
license.txt
(file).
src
(module).
Modules are listed depth-first from the system components tree.
alexa/src
license.txt
(file).
alexa
(system).
package.lisp
(file).
alexa.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
alexa/src/alexa.lisp
package.lisp
(file).
src
(module).
define-string-lexer
(macro).
lexer-match-error
(condition).
copy-pattern
(function).
empty-match-error
(function).
extract-registers
(function).
fill-in-aliases
(function).
generate-pattern-execution-code
(function).
generate-pattern-match-code
(function).
let-lazy
(macro).
make-pattern
(function).
non-negative-fixnum
(type).
pattern
(structure).
pattern-code
(reader).
(setf pattern-code)
(writer).
pattern-fire-name
(reader).
(setf pattern-fire-name)
(writer).
pattern-num-registers
(reader).
(setf pattern-num-registers)
(writer).
pattern-p
(function).
pattern-parse-tree
(reader).
(setf pattern-parse-tree)
(writer).
pattern-regex
(reader).
(setf pattern-regex)
(writer).
pattern-register-names
(reader).
(setf pattern-register-names)
(writer).
pattern-register-variables
(function).
pattern-scanner-name
(reader).
(setf pattern-scanner-name)
(writer).
pattern-short-circuit-p
(reader).
(setf pattern-short-circuit-p)
(writer).
walk-tree
(function).
Packages are listed by definition order.
alexa
A lexical analyzer generator.
common-lisp
.
define-string-lexer
(macro).
lexer-match-error
(condition).
copy-pattern
(function).
empty-match-error
(function).
extract-registers
(function).
fill-in-aliases
(function).
generate-pattern-execution-code
(function).
generate-pattern-match-code
(function).
let-lazy
(macro).
make-pattern
(function).
non-negative-fixnum
(type).
pattern
(structure).
pattern-code
(reader).
(setf pattern-code)
(writer).
pattern-fire-name
(reader).
(setf pattern-fire-name)
(writer).
pattern-num-registers
(reader).
(setf pattern-num-registers)
(writer).
pattern-p
(function).
pattern-parse-tree
(reader).
(setf pattern-parse-tree)
(writer).
pattern-regex
(reader).
(setf pattern-regex)
(writer).
pattern-register-names
(reader).
(setf pattern-register-names)
(writer).
pattern-register-variables
(function).
pattern-scanner-name
(reader).
(setf pattern-scanner-name)
(writer).
pattern-short-circuit-p
(reader).
(setf pattern-short-circuit-p)
(writer).
walk-tree
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Define a lexical analyzer named NAME.
Defining a lexical analyzer is actually defining a function named NAME whose lambda list is
(STRING &KEY (START 0) (END (LENGTH STRING)))
The STRING is the string to be analyzed, and START/END are the starting and ending positions to be looked at. Calling the function named NAME will produce a closure which, if called repeatedly, will produce results according to the lexical rules defined. When the input string is exhausted, NIL is returned, and the string will be unbound within the closure to allow garbage collection.
If STRING is not a SIMPLE-STRING, then it will be coerced into one (which will cons).
The lexer will fire the action which had the longest match, and ties are broken based on the order of the actions (earlier ones are preferred). This rule can be selectively disabled for a particular action if one declares it to be a short circuiting (see below).
Signals LEXER-MATCH-ERROR as a continuable error if no match was found.
The syntax of BODY is:
<doc string>?
(<alias definition>*)
<lexical action>*
An <alias definition> is a list
(<keyword> <regex string>)
The name of the keyword may be used in the <lexical action> regexes. A <lexical action> is a list
(<pattern spec> &body <code>)
A <pattern spec> has the following grammar:
<pattern spec> := <regex string>
| (EAGER <regex string>)
The EAGER option is defined below.
The <regex string> is matched against the input string greedily and in the order they are listed in the BODY. When the longest match is found, assuming no EAGER declarations, it will execute <code>. Within <code>, the following symbols are bound:
$1, $2, ..., $n: String match on (unnamed) register n
$NAME : String match on named register (?<NAME>...)
$@ : Entire string match.
$<, $> : Start and end position of match.
Generally, <code> should explicitly RETURN some token object for a semantic analyzer to examine. Currently, only a single value can be returned. (All other values will be ignored.) An explicit RETURN is needed. If no RETURN is provided, then the lexer will throw away the match and move on as if the lexer were called again. (This is most often used to ignore matches, like whitespace.)
The <regex string> of the lexical action may use the names of the symbols defined in the <alias definition> forms. For example, given the alias definitions
((:int "\\d+")
(:ident "[a-z]+"))
one can use {{INT}} and {{IDENT}} within the <regex string>s of the <lexical action>.
If the <pattern spec> uses EAGER, then the lexical action will "short circuit". The EAGER option states that if a match occurs on this pattern, <code> should be executed immediately, disregarding the "longest match" rule. This can be used for certain kinds of optimizations.
Error to be signaled if the lexer didn’t find a match.
simple-error
.
code
.
structure-object
.
string
boolean
integer
list
symbol
symbol
Jump to: | (
C D E F G L M P W |
---|
Jump to: | (
C D E F G L M P W |
---|
Jump to: | C F N P R S |
---|
Jump to: | C F N P R S |
---|
Jump to: | A C F L M N P S T |
---|
Jump to: | A C F L M N P S T |
---|