ArchWizard

DGD/

source navigation ]
diff markup ]
identifier search ]
file search ]
Version: [ 1.0.a0 ] [ 1.1 ] [ 1.2 ] [ 1.2p1 ] [ 1.2p2 ] [ 1.2p3 ] [ 1.2p4 ] [ 1.2.151 ]

  1 NOTE:
  2 
  3 This file is still so incomplete as to be useless.  There is no
  4 reference documentation for LPC as yet.  Sorry.
  5 
  6 
  7 <HTML>
  8 
  9 <HEAD>
 10  <TITLE>
 11  The LPC Reference Manual
 12  </TITLE>
 13 
 14 </HEAD>
 15 <BODY>
 16 
 17  <H1> The LPC Reference Manual </H1>
 18  Copyright &copy; 1995 - 1997 BeeHive Internet Technologies, Inc.
 19 
 20 
 21  <H2> 1. Introduction </H2>
 22 
 23  <H3> 1.1. Purpose </H3>
 24 
 25 This document is a formal description of the LPC programming language.
 26 The LPC programming language is derived from C and named after its primary
 27 creator, Lars Pensjö.  Several dialects of LPC exist; the programming
 28 language described here is the one used in <I>Dworkin's Generic Driver</I>
 29 (DGD) version 1.1.
 30 
 31 <!-- I will use the term LPCd to indicate the DGD dialect of LPC in
 32      particular. -->
 33 
 34 
 35  <H3> 1.2. History </H3>
 36 
 37 <!-- First came LPmud 1, then LPmud 2, etc.
 38      Game driver vs. multipurpose server. -->
 39 
 40 
 41  <H2> 2. Environment </H2>
 42 
 43 <!-- A description of objects, the server and clients.
 44      Compilation of files to objects.  Translation phases (preprocessor).
 45      ASCII code used, ISO 8859-1 recommended extension.
 46      Value of newline etc. is fixed.
 47      A description of which functions are called by the server, and when. -->
 48 
 49 
 50  <H2> 3. Language </H2>
 51 
 52 In the syntax notation of this document, syntactic catagories are
 53 indicated by <I>italic</I> type.
 54 
 55 
 56  <H3> 3.1. Lexical elements </H3>
 57  <H3> 3.1.1. Tokens </H3>
 58 
 59 A <I>token</I> is the minimal lexical element of the language.  The
 60 categories of tokens are:
 61 <I><A HREF="#identifiers">identifiers</A></I>,
 62 <I><A HREF="#keywords">keywords</A></I>,
 63 <I><A HREF="#constants">constants</A></I>,
 64 <I><A HREF="#operators">operators</A></I> and
 65 <I><A HREF="#punctuators">punctuators</A></I>.  Tokens are separated by
 66 white space: blanks, horizontal and vertical tabs, newlines, carriage returns,
 67 formfeeds and comments.
 68 
 69 
 70  <H3> 3.1.2. Comments </H3>
 71 
 72 A comment is a sequence of characters starting with the characters <TT>/*</TT>
 73 and terminated by the characters <TT>*/</TT>.  All characters in between are
 74 part of the comment.  Comments count as whitespace separating tokens, and
 75 may not be nested.  The sequence <TT>/*</TT> does not start a comment if it
 76 is part of a string.
 77 
 78 
 79  <H3> <A NAME="identifiers"> 3.1.3. Identifiers </A> </H3>
 80 
 81 An identifier is an arbitrary long sequence of letters, digits and
 82 underscores.  The first character must be a letter or underscore.  Upper- and
 83 lower-case letters are different.  Only the first 1023 characters of
 84 identifiers are significant.
 85 
 86 
 87  <H3> <A NAME="keywords"> 3.1.4. Keywords </A> </H3>
 88 
 89 The following identifiers are reserved for use as keywords:
 90 
 91   <PRE>
 92         atomic      do          int         private     varargs
 93         break       else        mapping     return      void
 94         case        float       mixed       rlimits     while
 95         catch       for         nil         static
 96         continue    if          nomask      string
 97         default     inherit     object      switch
 98   </PRE>
 99 
100 
101  <H3> <A NAME="constants"> 3.1.5. Constants </A> </H3>
102 
103 A <I>constant</I> is either an
104 <I><A HREF="#integer constants">integer constant</A></I>,
105 <I><A HREF="#floating constants">floating constant</A></I>,
106 <I><A HREF="#string constants">string constant</A></I> or
107 <I><A HREF="#character constants">character constant</A></I>.
108 
109 
110  <H3> <A NAME="integer constants"> 3.1.5.1. Integer Constants </A> </H3>
111 
112 An <I>integer constant</I> is a <I>decimal constant</I>, <I>octal constant</I>
113 or <I>hexadecimal constant</I>.
114 <P>
115 A sequence of digits is taken to be a <I>decimal constant</I> (base ten)
116 unless it begins with <TT>0</TT>.  A sequence of digits starting with <TT>0</TT>
117 and not including <TT>8</TT> or <TT>9</TT> is an <I>octal constant</I>
118 (base 8).  A sequence of digits and upper- or lower-case letters in range
119 <TT>A</TT> through <TT>F</TT>, preceded by <TT>0x</TT> or <TT>0X</TT> is a
120 <I>hexadecimal constant</I> (base 16, where <TT>A</TT> through <TT>F</TT>
121 have the decimal values 10 through 15).
122 <P>
123 <I>Integer constants</I> are represented by 32 bit 2's complement arithmetic,
124 and range from -2147483648 through 2147483647.  It is an error to specify a
125 <I>decimal constant</I> that is too large to be represented.  <I>Octal
126 constants</I> and <I>hexadecimal constants</I>, when too large, are
127 truncated to the lower 32 bits.
128 <P>
129 
130 <!-- For instance, the number forty-seven can be written as 47, 057 or 0x2f.
131      There is a problem particular to LPCd with regard to -2147483648.  Since
132      LPCd, unlike C, has no unsigned type, the decimal version of this number
133      (which is scanned as - 2147483648) is the negation of a number too large
134      to be represented.  - and 2147483648 cannot be read as a single token,
135      because then 1-2147483648 would be scanned as two consecutive integers.
136      This number must be specified by an octal or hexadecimal constant. -->
137 
138 
139  <H3> <A NAME="floating constants"> 3.1.5.2. Floating constants </A> </H3>
140 
141 A <I>floating constant</I> consists of an integer part, a decimal point, a
142 fraction part, and an exponent part, consisting of an <TT>e</TT> or <TT>E</TT>
143 and an optionally signed integer exponent.  Either the integer part or the
144 fraction part, but not both, may be missing.  Either the decimal point and
145 fraction part, or the exponent part, but not both, may be missing.
146 <P>
147 <I>Floating constants</I> represent a floating point number in the range of
148 -1.79769313485E308 through 1.79769313485E308, the smallest possible number
149 being -2.22507385851E-308.  It is an error to specify a <I>floating constant</I>
150 that is too large to be represented.  Numbers which are too small are
151 flushed to zero.
152 
153 
154  <H3> <A NAME="string constants"> 3.1.5.3. String constants </A> </H3>
155 
156 A <I>string constant</I> is a sequence of zero or more characters enclosed
157 in double quotes.  All characters, with the exception of newline, can be used in
158 a <I>string constant</I>.  A backslash character <TT>\</TT> introduces an
159 escape sequence, which consists of at least 2 and at most 5 characters
160 (including the backslash), and which is translated into a single character in
161 the string.  The following escape sequences can be used:
162 
163  <PRE>
164         \a = 007 (bell)                 \o
165         \b = 010 (backspace)            \oo
166         \f = 014 (form feed)            \ooo
167         \n = 012 (newline)              \xh
168         \r = 015 (carriage return)      \xhh
169         \t = 011 (horizontal tab)       \xhhh
170         \v = 013 (vertical tab)         \c
171  </PRE>
172 
173 The value of <TT>\a</TT>, <TT>\b</TT>, <TT>\f</TT>, <TT>\n</TT>, <TT>\r</TT>,
174 <TT>\t</TT> and <TT>\v</TT> is the octal value shown.  <TT>\o</TT>,
175 <TT>\oo</TT> and <TT>\ooo</TT> constitute an integer of at most 3 octal
176 digits, the octal value of which specifies a single character.  <TT>\xh</TT>,
177 <TT>\xhh</TT> and <TT>\xhhh</TT> constitute an integer of at most 3 hexadecimal
178 digits, the hexadecimal value of which specifies a single character.  All other
179 escape sequences <TT>\c</TT> specify the character <TT>c</TT> (any character
180 except <TT>a</TT>, <TT>b</TT>, <TT>f</TT>, <TT>n</TT>, <TT>r</TT>, <TT>t</TT>,
181 <TT>v</TT>, <TT>x</TT>, or a digit), which itself is not interpreted in any
182 special way.
183 
184 <!-- For example, "\"" is the string constant consisting of a double quote
185      character.  "\g\?\0123" is the same as "g?\n3".
186      The value of \a .. \v is fixed, and identical on all hosts, even on
187      those which have C compilers with different values for them.
188      Note that at most three hexadecimal digits can be used, even though all
189      characters can be expressed with just two. -->
190 
191 
192  <H3> <A NAME="character constants">3.1.5.4. Character constants </A> </H3>
193 
194 A <I>character constant</I> consists of a single character or escape sequence,
195 enclosed in single quotes.  All characters except newline can be used.
196 Escape sequences are handled as with <I><A HREF="#string constants">string
197 constants</A></I>.
198 
199 <!-- So-called multiple character constants are not allowed. -->
200 
201 
202  <H3> <A NAME="operators"> 3.1.6. Operators </A> </H3>
203 
204 The following are operators:
205 
206  <PRE>
207         [   ]   (   )   -&gt;
208         ++  --  +   -   ~   !   ... catch
209         *   /   %   &lt;&lt;  &gt;&gt;  &lt;   &gt;   &lt;=  &gt;=  ==  !=  &amp;   ^   |   &amp;&amp;  ||
210         ?   :
211         =   *=  /=  %=  +=  -=  &lt;&lt;= &gt;&gt;= &amp;=  ^=  |=
212         ,
213  </PRE>
214 
215 
216  <H3> <A NAME="punctuators"> 3.1.7. Punctuators </A> </H3>
217 
218  <H3> 3.2. Expressions </H3>
219 
220  <H3> 3.3. Constant expressions </H3>
221 
222  <H3> 3.4. Declarations </H3>
223 
224  <H3> 3.5. Statements </H3>
225 
226  <H3> 3.6. Inheritance </H3>
227 
228  <H3> 3.7. Preprocessing directives </H3>
229 
230 </BODY>
231 </HTML>

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.