Imported from ../lua-3.1.tar.gz.
[lua.git] / doc / luac.man
blobe5c90738de41de057c9117f43814593533b3d69a
1 .\" $Id: luac.man,v 1.11 1998/07/01 14:51:45 lhf Exp $
2 .TH LUAC 1 "01 July 1998"
3 .SH NAME
4 luac \- Lua compiler
5 .SH SYNOPSIS
6 .B luac
8 .B \-c
10 .B \-u
11 ] [
12 .B \-d
13 ] [
14 .B \-D
15 .I name
16 ] [
17 .B \-l
18 ] [
19 .B \-o
20 .I filename
21 ] [
22 .B \-O
23 ] [
24 .B \-p
25 ] [
26 .B \-q
27 ] [
28 .B \-v
29 ] [
30 .B \-V
32 .IR sourcefile " ..."
33 .SH DESCRIPTION
34 .B luac
35 is the Lua compiler.
36 It translates programs written in the Lua programming language
37 into binary files that can be loaded and executed with
38 .B lua_dofile
39 in C or with
40 .B dofile
41 in Lua.
42 .LP
43 The main advantages of pre-compiling chunks are:
44 faster loading,
45 protecting source code from user changes,
46 off-line syntax error detection.
47 The binary files created by
48 .B luac
49 are portable to all known architectures.
50 .LP
51 .B luac
52 produces a single output file containing the bytecodes
53 for all source files given.
54 By default,
55 the output file is named
56 .BR luac.out ,
57 but you can change this with the
58 .B \-o
59 option.
60 .LP
61 You can use
62 .B "\-"
63 to indicate
64 .I stdin
65 as a source file.
66 .LP
67 .B luac
68 can also load and list binary files with the
69 .B \-u
70 option.
71 .LP
72 Binary files produced by differents runs of
73 .B luac
74 can be combined into one large file,
75 using 
76 .BR cat (1).
77 The result is still a valid binary file,
78 and can be loaded with a single call to
79 .B lua_dofile
80 or 
81 .BR dofile .
82 .LP
83 .SH OPTIONS
84 .TP
85 .B \-c
86 compile (this is the default).
87 .TP
88 .B \-u
89 undump, i.e., load and list the given binary files.
90 If no files are given, then luac undumps
91 .BR luac.out .
92 .TP
93 .BI \-D " name"
94 predefine symbol
95 .I name
96 for conditional compilation.
97 By default,
98 .B luac
99 does
100 .I not
101 predefine any symbols,
102 not even the built-in functions.
104 .B \-d
105 turn debugging on.
106 Individual chunks may
107 still control the generation of debug information with
108 $debug and $nodebug.
109 If debugging is on, then listings show the names of the local variables.
111 .B \-l
112 produce a listing of the compiled bytecode for Lua's virtual machine.
113 This is the default when undumping.
115 .B \-O
116 optimize code.
117 Debug information is removed,
118 duplicate constants are coalesced.
120 .BI \-o " filename"
121 output to
122 .IR filename ,
123 instead of the default
124 .BR luac.out .
125 The output file cannot be a source file.
127 .B \-p
128 parse sources files but does not generate any output file.
129 Used mainly for syntax checking.
131 .B \-q
132 quiet; produces no listing.
133 This is the default when compiling.
135 .B \-v
136 print version information.
138 .B \-V
139 verbose;
140 print the names of the source files as they are processed.
141 .SH FILES
142 .TP 15
143 .B luac.out
144 default output file
145 .SH "SEE ALSO"
146 .BR lua (1)
148 .I "Reference Manual of the Programming Language Lua"
150 http://www.tecgraf.puc-rio.br/lua/
152 "Lua: an extensible extension language",
153 .I Software: Practice & Experience
154 .B 26
155 #6 (1996) 635-652.
156 .SH DIAGNOSTICS
157 Error messages should be self explanatory.
158 .SH BUGS
159 Inherits any bugs from Lua,
160 but Lua has no bugs...
161 .SH AUTHORS
162 L. H. de Figueiredo,
163 R. Ierusalimschy and
164 W. Celes
165 .I (lua@tecgraf.puc-rio.br)