516229d669d5528b3b48b397ceda6ca7903ece32
[external/ragel.git] / doc / rlcodegen.1.in
1 .\"
2 .\"   Copyright 2001 Adrian Thurston <thurston@cs.queensu.ca>
3 .\"
4
5 .\"   This file is part of Ragel.
6 .\"
7 .\"   Ragel is free software; you can redistribute it and/or modify
8 .\"   it under the terms of the GNU General Public License as published by
9 .\"   the Free Software Foundation; either version 2 of the License, or
10 .\"   (at your option) any later version.
11 .\"
12 .\"   Ragel is distributed in the hope that it will be useful,
13 .\"   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 .\"   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 .\"   GNU General Public License for more details.
16 .\"
17 .\"   You should have received a copy of the GNU General Public License
18 .\"   along with Ragel; if not, write to the Free Software
19 .\"   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
20
21 .\"   Process this file with
22 .\"   groff -man -Tascii rlcodegen.1
23 .\"
24 .TH RAGEL 1 "@PUBDATE@" "Ragel @VERSION@" "Ragel State Machine Compiler"
25 .SH NAME
26 rlcodegen \- code generator for Ragel State Machine Compiler
27 .SH SYNOPSIS
28 .B rlcodegen 
29 .RI [ options ]
30 .I file
31 .SH DESCRIPTION
32 .B Note:
33 this is the backend component of Ragel. This program accepts a machine
34 compiled by the frontend program ragel(1) and generates either code or a
35 graphviz dot file.
36
37 .SH OPTIONS
38 .TP
39 .BR \-h ", " \-H ", " \-? ", " \-\-help
40 Display help and exit.
41 .TP
42 .B \-o " file"
43 Write output to file. If -o is not given, a default file name is chosen by
44 replacing the suffix of the input. For source files ending in .rh the suffix .h
45 is used. For all other source files a suffix based on the output language
46 is used (.c, .cpp, .m, .dot)
47 .TP
48 .B \-V
49 Generate a Graphviz dotfile instead of code. By default this option writes the
50 dotfile to standard output. The frontend options -M and -S can be used
51 to specify a subset of the grammar to write.
52 .TP
53 .B \-p
54 Print printable characters in Graphviz output.
55 .TP
56 .B \-T0
57 Generate a table driven FSM. This is the default code style.  The table driven
58 FSM represents the state machine as static data. There are tables of states,
59 transitions, indicies and actions. The current state is stored in a variable.
60 The execution is a loop that looks that given the current state and current
61 character to process looks up the transition to take using a binary search,
62 executes any actions and moves to the target state. In general, the table
63 driven FSM produces a smaller binary and requires a less expensive host language
64 compile but results in slower running code. The table driven FSM is suitable
65 for any FSM.
66 .TP
67 .B \-T1
68 Generate a faster table driven FSM by expanding action lists in the action
69 execute code.
70 .TP
71 .B \-F0
72 Generate a flat table driven FSM. Transitions are represented as an array
73 indexed by the current alphabet character. This eliminates the need for a
74 binary search to locate transitions and produces faster code, however it is
75 only suitable for small alphabets.
76 .TP
77 .B \-F1
78 Generate a faster flat table driven FSM by expanding action lists in the action
79 execute code.
80 .TP
81 .B \-G0
82 Generate a goto driven FSM. The goto driven FSM represents the state machine
83 as a series of goto statements. While in the machine, the current state is
84 stored by the processor's instruction pointer. The execution is a flat function
85 where control is passed from state to state using gotos. In general, the goto
86 FSM produces faster code but results in a larger binary and a more expensive
87 host language compile.
88 .TP
89 .B \-G1
90 Generate a faster goto driven FSM by expanding action lists in the action
91 execute code.
92 .TP
93 .B \-G2
94 Generate a really fast goto driven FSM by embedding action lists in the state
95 machine control code.
96 .SH BUGS
97 Ragel is still under development and has not yet matured. There are probably
98 many bugs.
99 .SH CREDITS
100 Ragel was written by Adrian Thurston <thurston@cs.queensu.ca>.  Objective-C
101 output contributed by Eric Ocean. D output contributed by Alan West. 
102 .SH "SEE ALSO"
103 .BR ragel (1),
104 .BR re2c (1),
105 .BR flex (1)
106
107 Homepage: http://www.cs.queensu.ca/home/thurston/ragel/