UP
PREVIOUS
NEXT

## Summary of Source Format.

The general form of a Lex source file is:

{definitions}
%%
{rules}
%%
{user subroutines}

The definitions section contains
a combination of
**1)
**
Definitions, in the form ``name space translation''.

**2)
**
Included code, in the form ``space code''.

**3)
**
Included code, in the form

%{
code
%}

**4)
**
Start conditions, given in the form

%S name1 name2 ...

**5)
**
Character set tables, in the form

%T
number space character-string
...
%T

**6)
**
Changes to internal array sizes, in the form

%*x* *nnn*

where *nnn* is a decimal integer representing an array size
and *x* selects the parameter as follows:
Letter Parameter
p positions
n states
e tree nodes
a transitions
k packed character classes
o output array size

Lines in the rules section have the form ``expression action''
where the action may be continued on succeeding
lines by using braces to delimit it.

Regular expressions in Lex use the following
operators:

x the character "x"
"x" an "x", even if x is an operator.
\x an "x", even if x is an operator.
[xy] the character x or y.
[x-z] the characters x, y or z.
[^x] any character but x.
. any character but newline.
^x an x at the beginning of a line.
<y>x an x when Lex is in start condition y.
x$ an x at the end of a line.
x? an optional x.
x* 0,1,2, ... instances of x.
x+ 1,2,3, ... instances of x.
x|y an x or a y.
(x) an x.
x/y an x but only if followed by y.
{xx} the translation of xx from the definitions section.
x{m,n} *m* through *n* occurrences of x

UP
PREVIOUS
NEXT