]> git.xonotic.org Git - xonotic/gmqcc.git/blob - doc/specification.tex
Update specification.tex
[xonotic/gmqcc.git] / doc / specification.tex
1 \documentclass{article}
2
3 %%% PACKAGES
4 \usepackage{geometry}
5 \usepackage[utf8]{inputenc}
6 \usepackage[parfill]{parskip}
7 \usepackage{subfig}
8 \usepackage{listings}
9 \usepackage{color}
10 \usepackage{sectsty}
11
12 %%% GEOMETRY FOR DOCUMENT
13 \geometry{a4paper}
14
15 %%% HEADERS/FOOTERS APPEARANCE
16 \usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
17 \pagestyle{fancy} % options: empty , plain , fancy
18 \renewcommand{\headrulewidth}{0pt} % customise the layout...
19 \lhead{}\chead{}\rhead{}
20 \lfoot{}\cfoot{\thepage}\rfoot{}
21
22 %%% SECTION TITLE APPEARANCE
23 \allsectionsfont{\sffamily\mdseries\upshape} % (See the fntguide.pdf for font help)
24
25 %%% ToC APPEARANCE
26 \usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
27 \usepackage[titles,subfigure]{tocloft} % Alter the style of the Table of Contents
28 \renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
29 \renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} % No bold!
30
31 %%% listing language definitions
32 %%% BNF for now, QuakeC will be later
33 \definecolor{keyword1}{RGB}{0,102,153}
34 \definecolor{keyword2}{RGB}{0,153,102}
35 \definecolor{keyword3}{RGB}{0,153,255}
36 \definecolor{comment}{RGB}{204,0,0}
37 \definecolor{function}{RGB}{153,102,255}
38 \definecolor{digit}{RGB}{255,0,0}
39 \definecolor{string}{RGB}{255,0,204}
40 \definecolor{rule}{RGB}{192,192,192}
41 \definecolor{back}{RGB}{250,250,250}
42
43 \lstdefinelanguage{bnf}{
44   keywordstyle={\color{keyword2}\bfseries},
45   keywords={},
46   otherkeywords={::=,|},
47   morecomment=[s][\color{comment}]{(*}{*)},
48   stringstyle=\color{string},
49   morestring=[b]",
50   morestring=[b]',
51   morestring=[b]/,
52   showstringspaces=false,
53   frame=none,
54   rulecolor=\color{rule},
55   backgroundcolor=\color{back}
56 }
57
58 %% Title Information %%
59 \title{The GMQCC QuakeC Programming Language}
60 \author{Dale Weiler}
61 \date{\today}
62
63 \begin{document}
64
65 %% Title Page %%
66 \maketitle
67 \thispagestyle{empty}
68 \raggedright
69 \abstract
70 This document specifies the form and establishes the interpretation of programs written in
71 the GMQCC QuakeC programming language variant (refereed simply as QuakeC throughout this
72 document). It specifies:
73 \begin{itemize}
74         \item the representation of QuakeC programs;
75         \item the syntax and constraints of the QuakeC language;
76         \item the semantic rules for interpreting QuakeC programs;
77         \item the representation of input data to be processes by QuakeC programs;
78         \item the representation of output data produced by QuakeC programs;
79         \item the restrictions and limits imposed by a conforming implementation of QuakeC.
80 \end{itemize}
81 This document does not specify
82 \begin{itemize}
83         \item the mechanism by which QuakeC programs are transformed for use by a data-
84               processing system;
85         \item the mechanism by which QuakeC programs are invoked for use by a data-processing
86               system;
87         \item the mechanism by which input data are transformed for use by a QuakeC program;
88         \item the size or complexity of a program and its data that will exceed the capacity
89               of any specific data-processing system or the capacity of a particular
90               execution environment;
91         \item all minimal requirements of a data-processing system that is capable of
92               supporting a conforming implementation.
93 \end{itemize}
94
95 %% Table Of Contents %%
96 \newpage
97 \thispagestyle{empty}
98 \tableofcontents
99 \newpage
100
101 %% Begin Contents %%
102 \raggedright % No weird TEX spacing on lines to fill page
103
104 %% -> Terms, definitions, and symbols %%
105 \section{Terms, definitions, and symbols}
106 \subsection*{argument}
107 Expression in the comma-separated list bounded by the parentheses in a function call
108 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
109 by the parentheses in a function-like macro invocation.
110
111 \subsection*{behavior}
112 External appearance or action
113
114 \subsection*{implementation-defined behavior}
115 Unspecified behavior where each implementation documents how the choice is made.
116
117 \subsection*{undefined behavior}
118 Behavior, upon use of a non-portable or erroneous program construct or of erroneous data,
119 for which this document imposes no actual requirements.
120
121 \subsection*{unspecified behavior}
122 Use of an unspecified value, or other behavior where this document provides two or more
123 possibilities and imposes no further requirements on which is chosen in any instance.
124
125 \subsection*{constraint}
126 Restriction, either syntactic or semantic, by which the exposition of language elements
127 is to be interpreted.
128
129 \subsection*{diagnostic message}
130 Message belonging to an implementation-defined subset of the implementation's message
131 output.
132
133 \subsection*{object}
134 Region of data storage in the execution environment, the contents of which can represent
135 values.
136
137 \subsection*{parameter}
138 Object declare as part of a function declaration or definition that acquires a value on
139 entry to the function, or an identifier from the comma-separated list bounded by the
140 parentheses immediately following the macro name in a function-like macro definition.
141
142 \subsection*{recommended practice}
143 Specification that is strongly recommended as being in keeping with the intent of this
144 document, but that may be impractical for some implementations.
145
146 \subsection*{value}
147 Precise meaning of the contents of an object when interpreted as having a specific type.
148
149 \subsection*{implementation-defined value}
150 Unspecified value where each implementation documents how the choice is made.
151
152 \subsection*{unspecified value}
153 Valid value of the relevant type where this document imposes no requirements on which
154 value is chosen in any instance.
155
156 %% -> Conformance %%
157 \section{Conformance}
158 In this document, "shall" is to be interpreted as a requirement on an implementation
159 or on a program; conversely, "shall not" is to be interpreted as a prohibition. \\
160 If a "shall" or "shall not" requirement that appears outside of a constraint is violated,
161 the behavior is undefined.  Undefined behavior is otherwise indicated in this document by
162 the words "undefined behavior" or by the omission of any explicit definition of behavior.
163 There is no difference in emphasis among these three; they all describe "behavior that is
164 undefined".
165
166 %% -> Enviroment %%
167 \section{Environment}
168 An implementation that translates QuakeC source files and executes QuakeC programs in two
169 data processing-system environments, which will be called the translation environment and
170 the execution environment in this document. Their characteristics define and constrain the
171 results of executing QuakeC programs constructed according to the syntactic and semantic
172 rules for conforming implementations.
173 \subsection{Conceptual models}
174 \subsubsection{Translation environment}
175 \paragraph*{Translation steps}
176 The precedence among the syntax rules of translation is specified by the following steps
177 \begin{itemize}
178         \item Physical source file characters are mapped, in an implementation-defined manner,
179               to the source character set (introducing new-line characters for end-of-line
180               indicators) if necessary.  Trigraph and digraph sequences are replaced by their
181               corresponding single-character internal representations.
182         \item The source file is decomposed into preprocessing tokens and sequences of white-
183               space characters (including comments). A source file shall not end in a partial
184               preprocessing token or in a partial comment. Each comment is replaced by one
185               space character. New-line characters are retained. Whether each nonempty
186               sequences of white-space characters other than new-line is retained or replaced
187               by one space character is implementation-defined.
188         \item Preprocessing directives are executed, macro invocations are expanded 
189               recursively. A \#include preprocessing directive causes the named header or
190               source file to be processes from step one through step three, recursively. All
191               preprocessing directives are then deleted.
192         \item Each source character set member and escape sequence in character constants and
193               string literals is converted to the corresponding member of the execution
194               character set; if there is no corresponding member, it is converted to an
195               implementation-defined member other than the null character.
196         \item Adjacent string literal tokens are concatenated.
197         \item White-space characters seperating tokens are no longer significant. Each
198               preprocessing token is converted into a token. The resulting tokens are then
199               syntactically and semantically analyzed and translated.                         
200 \end{itemize}
201 \subparagraph*{Footnotes}
202 Implementations shall behave as if these separate steps occur, even though many are likely
203 to be folded together in practice. Source files need not be stored as file, nor need there
204 be any one-to-one correspondence between these items and any external representation. The
205 description is conceptual only, and does not specify any particular implementation.
206
207 \paragraph*{Diagnostics}
208 A conforming implementation shall produce at least on diagnostic message(identified in an
209 implementation-defined manner) if a source file contains a violation of any syntax rule or
210 constraint, even if the behavior is also explicitly specified as undefined or
211 implementation-defined. Diagnostic messages need not be produced in other circumstances.
212
213 %% ->-> Execution environments %%
214 \subsubsection{Execution environments}
215 Two execution environments are defined
216
217 %% -> Language %%
218 \section{Language}
219 \subsection{Notation}
220 The syntax notation used in this document is that of a BNF specification.  A set of
221 derivation rules, often written as:
222 \begin{lstlisting}[language=bnf]
223         symbol ::= expression
224 \end{lstlisting}
225 Where symbol is a nonterminal, and the expression consists of one or more sequences of
226 symbols; more sequences are separated by a vertical bar \textbar, indicating a choice,
227 the whole being a possible substitution for the symbol on the left.  Symbols that never
228 appear on the left side are terminals.
229 \linebreak
230 This document defines language syntax throughout it's way at defining language
231 constructs If you're interested in a summary of the language syntax, one is given in 
232 annex A.
233
234 %% -> Concepts %%
235 \subsection{Concepts}
236 %% ->-> Scopes of identifiers %%
237 \subsubsection{Scopes of identifiers}
238 An identifier can denote an object; a function, or enumeration; a label name; a macro
239 name; or a macro parameter. The same identifier can denote difference items at different
240 point in the program. A member of an enumeration is called an enumeration constant.
241 Macro names and macro parameters are not considered further here, because prior to the
242 semantic phase of program translation any occurrences of macro names in the source file
243 are replaced by the preprocessing token sequences that constitute their macro definitions.
244 \linebreak
245
246 For each different item that an identifier designates, the identifier is visible (i.e, 
247 can be used) only within a region of program text called its scope.  Different items 
248 designated by the same identifier either have different scopes, or are in different name
249 spaces. There are four kinds of scopes: function, file, block and function prototype.
250 (A function prototype is a declaration of a function that declares the types of its
251 parameters.)
252 \linebreak
253
254 A label name is the only kind of identifier that has function scope.  It can be used (in 
255 a goto statement) anywhere in the function in which it appears, and is declared
256 implicitly by its syntactic appearance (prefixed by a : and a statement).
257 \linebreak
258
259 Every other identifier has scope determined by the placement of its declaration (in a 
260 declarator or type specifier).  If the declarator or types specifier that declares the 
261 identifier appears outside any block or list of parameters, the identifier has file 
262 scope,  which terminates at the end of the file.  If the declartor or type specifier that
263 declares the identifier appears inside a block or within the list of parameter
264 declarations in a  function definition, the identifier has block scope, which terminates
265 at the end of the  associated block.  If the declarator or type specifier that declares 
266 the identifier appears  within the list of parameter declarations in a function prototype
267 (not part of a function definition), the identifier has function prototype scope, which 
268 terminates at the end of the function declarator.  If an identifier designates two 
269 different items in the same  name space, the scopes might overlap.  If so, the scope of 
270 one item (the inner scope) will be a strict subset of the scope of the other item (the 
271 outer scope). Within the inner scope, the identifier designates the item declared in the
272 inner scope; the item declared in the  outer scope is hidden (and not visible) within 
273 the inner scope.
274 \linebreak
275
276 Unless explicitly stated otherwise, where this document uses the term "identifier" to 
277 refer to some item (as opposed to the syntactic construct), it refers to the item in the 
278 relevant name space whose declaration is visible at the point the identifier occurs.
279 \linebreak
280
281 Two identifiers have the same scope it and only if their scopes terminate at the same 
282 point.
283 \linebreak
284
285 Each enumeration constant has scope that begins just after the appearance of its defining
286 enumerator in an enumerator list. Any other identifier has scope that begins just after 
287 the completion of its declarator.
288
289 %% ->-> Name spaces of identifiers %%
290 \subsubsection{Name spaces of identifiers}
291 If more than one declaration of a particular identifier is visible at any point in a 
292 source file, the syntactic context disambiguates uses that refer to different items. 
293 Thus, there  are separate name spaces for various categories of identifiers, as follows:
294 \linebreak
295 \begin{itemize}
296         \item Label names (disambiguated by the syntax of the lbvel declaration and use);
297         \item Enumerations (disambiguated by following the keyword enum);
298         \item All other identifiers, called ordinary identifiers (declared in ordinary
299               declarators or as enumeration constants).
300 \end{itemize}
301
302 %% ->-> Types %%
303 \subsubsection{Types}
304 The meaning of a value stored in an object returned by a function is determined by the 
305 type  of the expression used to access it. (An identifier declared to be an object is the simplest
306 such expression; the type is specified in the declaration of the identifier.)  Types are 
307 partitioned into object types (types that fully describe objects), function types(types 
308 that  describe functions), and incomplete types(types that describe objects but lack 
309 information).
310 \linebreak
311
312 An object declared type bool is large enough to store the values 0 and 1.
313 \linebreak
314
315 An object declared type float is a real type; An object declared type vector is a 
316 comprised set of three floats that respectively represent the \underline{x,y,z} 
317 components of a three-dimensional vector.
318 \linebreak
319
320 An enumeration comprises a set of named integer constant values.  Each distinct 
321 enumeration constitutes a different enumerated type.
322 \linebreak
323
324 Enumeration types and float are collectively called arithmetic types. Each arithmetic 
325 type belongs to one type domain.
326 \linebreak
327
328 The void type comprises an empty set of values; it is an incomplete type that cannot be
329 completed.
330 \linebreak
331
332 A number of derived types can be constructed from the object, function and incomplete 
333 types, as follows:
334 \linebreak
335
336 \begin{itemize}
337         \item An array type describes a contiguously allocated nonempty set of objects with a 
338               particular object types, called the element type. Array types are characterized 
339               by their element type and by the number of elements in the array.  An array type
340               is said to be derived     from its element type, and if its element is type T, the 
341               array type is sometimes called "array of T".  The construction of an array type
342                   from an element type is called "array type derivation".
343         \item A function type described a function with a specified return type. A function
344                   type is characterized by its return type and the number and types of its
345                   parameters. A function type is said to be derived from its return type, and if 
346                   its return type is T, the function type is sometimes called "function returning
347                    T". The construction of a function type from a return type is called "function
348                    type derivation".
349 \end{itemize}
350
351 \
352
353 Arithmetic types are collectively called scalar types. Arrays and vectors are 
354 collectively called aggregate types.
355 \linebreak
356
357 An array of unknown size is an incomplete type.  It is completed, for an identifier of 
358 that byte, by specifying the size in a later declaration.  Arrays are required to have 
359 known constant size.
360 \linebreak
361
362 A type is characterized by its type category, which is either the outermost derivation 
363 of a derived type (as noted above in the construction of derived types), or the type 
364 itself if the type consists of no derived types.
365 \linebreak
366
367 Any type so far mentioned is an unqualified type.  Each unqualified type has several 
368 qualified version of its type, corresponding to the combinations of one, two, or all 
369 two of const and volatile qualifiers.  The qualified or unqualified versions of a type 
370 are distinct types that belong to the same type category and have the same representation.
371 A derived type is not qualified by the qualifiers (if any) of the type from which it 
372 is derived.
373 \linebreak
374
375 %% ->-> Compatible types and composite type %%
376 \subsubsection{Compatible types and composite type}
377 Two types have compatible type if their types are the same.
378 \linebreak
379
380 All declarations that refer to the same object or function shall have compatible type; 
381 otherwise the behavior is undefined.
382 \linebreak
383
384 A composite type can be constructed from two types that are compatible; it is a type that 
385 is compatible with both of the two types and satisfies the following conditions:
386 \begin{itemize}
387         \item If one type is an array, the composite type is an array of that size.
388         \item If only one type is a function type with a parameter type list(a function 
389               prototype), the composite type is a function prototype with the parameter type 
390               list.
391         \item If both types are function types with parameter type lists, the type of each 
392               parameter in the composite parameter type list is the composite type of the 
393               corresponding parameters.
394 \end{itemize}
395 These rules apply recursively to types from which the twp types are derived.
396 \linebreak
397
398 %% ->Conversions %%
399 \subsection{Conversions}
400 Several operators convert operand values from one type to another automatically. This 
401 sub-clause specified the result required from such an implicit conversion.
402 \linebreak
403
404 Conversion from an operand value to a compatible type causes no change to the value or
405 the representation.
406 \linebreak
407
408 %% ->->Aritmetic operands %%
409 \subsubsection{Arithmetic operands}
410 \paragraph*{Boolean type}
411 When any scalar value is converted to bool, the result is 0 if the value compares equal 
412 to 0; otherwise the result is 1.
413
414 %% ->->Other operands %%
415 \subsubsection{Other operands}
416 \paragraph{Lvalues, arrays and function designators}
417 An lvalue is an expression with an object type or an incomplete type other than void; 
418 if an lvalue does not designate an object when it is evaluated, the behavior is undefined.
419 When an object is said to have a particular type, the type is specified by the lvalue 
420 used to designate the object.  A modifiable lvalue is an lvalue that does not have an 
421 array type, does not have an incomplete type, does not have a const-qualified type.
422 \linebreak
423
424 Except when it is the operand of the unary \& operator, the ++ operator, the -- operator,
425 or the left operand of the . operator or an assignment operator, an lvalue that does not 
426 have array type is converted to the value stored in the designated object (and is no 
427 longer an lvalue).  If the lvalue has qualified type, the value has the unqualified 
428 version of the type of the lvalue; otherwise, the value has the type of the lvalue. If 
429 the lvalue has an incomplete type and does not have array type, the behavior is undefined.
430 \linebreak
431
432 A function designator is an expression that has function type.
433 \linebreak
434
435 \paragraph*{void}
436 The (nonexistent) value of a void expression (an expression that has type void) shall not 
437 be used in any way, and implicit conversions (except to void) shall not be applied to 
438 such an expression.  If an expression of any other type is evaluated as a void expression
439 , its value or designator is discarded. (A void expression is only evaluated for its 
440 side effects.)
441 \pagebreak
442
443 \subsection{Lexical elements}
444 \paragraph*{Syntax}
445 \begin{lstlisting}[language=bnf]
446 token ::= keyword    | identifier
447         | constant   | string-literal
448         | punctuator
449         
450 preprocessing-token := header-name | identifier
451                      | pp-number   | string-literal
452                      | punctuator
453 \end{lstlisting}
454 \paragraph*{Constraints}
455 Each preprocessing token that is converted to a token shall have the lexical form of a 
456 keyword, an identifier, a constant, a string literal, or a punctuator.
457
458 \paragraph*{Semantics}
459 TODO
460
461 %% ->-> Keywords %%
462 \subsubsection{Keywords}
463 \paragraph*{Syntax}
464 \begin{lstlisting}[language=bnf]
465 keyword ::= enum     | break
466           | return   | void
467           | case     | float
468           | volatile | for
469           | while    | const
470           | goto     | bool
471           | continue | if
472           | static   | default
473           | inline   | do
474           | switch   | else
475           | vector   | entity
476 \end{lstlisting}
477 \paragraph*{Semantics}
478 The above tokens (case sensitive) are reserved (in translation step seven and eight) for 
479 use as keywords, and shall not be used otherwise.
480
481 %% ->->Identifiers %%
482 \subsubsection{Identifiers}
483 \paragraph*{Syntax}
484 \begin{lstlisting}[language=bnf]
485 identifier ::= nondigit
486              | identifier nondigit
487              | identifier digit
488              
489 nondigit  ::= _ | a | b | c | d | e | f | g | h | i 
490             | j | k | l | m | n | o | p | q | r | s
491             | t | u | v | w | x | y | z | A | B | C
492             | D | E | F | G | H | I | J | K | L | M
493             | N | P | Q | R | S | T | U | V | W | X
494             | Y | Z
495
496 digit     ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
497 \end{lstlisting}
498
499 %% ->->Constants %%
500 \subsubsection{Constants}
501 \begin{lstlisting}[language=bnf]
502 constant             ::= integer-constant
503                        | floating-constant
504                        | enumeration-constant
505                        | character-constant
506                        | vector-constant
507            
508 integer-constant     ::= decimal-constant
509                        | octal-constant
510                        | hexadecimal-constant
511                    
512 decimal-constant     ::= nonzero-digit
513                        | decimal-constant digit
514                    
515 octal-constant       ::= 0
516                        | octal-constant octal-digit
517                    
518 hexadecimal-constant ::= hexdecimal-prefix
519                          hexadecimal-digit
520                        | hexadecimal-digit
521                          hexadecimal-constant
522
523 hexadecimal-prefix:  ::= 0x | 0X
524
525 nonzero-digit        ::= 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
526                        | 9
527                        
528 octal-digit          ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
529
530 hexadecimal-digit    ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
531                        | 8 | 9 | a | b | c | d | e | f
532                        | A | B | C | D | E | F
533 \end{lstlisting}
534
535 %% ->-> String literals %%
536 \subsubsection{String literals}
537 \begin{lstlisting}[language=bnf]
538 string-literal  := " s-char-sequence "
539
540 s-char-sequence := s-char
541                  | s-char-sequence s-char
542                  
543 s-char          := ` | ! | @ | # | $ | % | ^ | & | *
544                  | ( | ) | _ | - | + | = | { | } | [
545                  | ] | | | : | ; | ' | < | , | > | .
546                  | ? | / | 1 | 2 | 3 | 4 | 5 | 6 | 7
547                  | 8 | 9 | 0 | q | w | e | r | t | y
548                  | u | i | o | p | a | s | d | f | g
549                  | h | j | k | l | z | x | c | v | b 
550                  | n | m | Q | W | E | R | T | Y | U
551                  | I | O | P | A | S | D | F | G | |
552                  | H | J | K | L | Z | X | C | V | B
553                  | N | M
554 \end{lstlisting}
555 \paragraph*{Description}
556 A character string literal is a sequence of zero or more characters enclosed in 
557 double-quotes, as in "xyz".
558 \linebreak
559
560 The same considerations apply to each element of the sequence in a character string
561 literal as if it where an integer character constant, except that the single-quote 
562 ' is representable either by itself or by the escape sequence \textbackslash', but 
563 the double-quote " shall be represented by the escape sequence \textbackslash".
564
565 \paragraph*{Semantics}
566 In translation stage six, the character sequences specified by any sequence of adjacent 
567 character string literal tokens are concatenated into a single character sequence.
568
569 %% ->-> Punctuators %%
570 \subsubsection{Punctuators}
571 TODO: BNF
572
573 A punctuator is a symbol that has independent syntactic and semantic significance. 
574 Depending on context, it may specify an operation to be performed (which in turn 
575 may yield a value or a function designator, produce a side effect, or some combination 
576 thereof) in which case it is known as an operator (other forms of operator also exist 
577 in some contexts). An operand is an item on which an operator acts.
578 \linebreak
579
580 TODO: Trigraphs \& Digraphs
581
582 \subsubsection{Header names}
583 TODO
584 \subsubsection{Preprocessing numbers}
585 TODO
586 \subsubsection{Comments}
587 Except within a character constant, a string literal, or a comment, the characters /* 
588 introduce a comment.  The contents of such a comment are examined only to identify 
589 characters and to find the characters /* that terminate it.
590 \linebreak
591
592 Except within a character constant, a string literal, or a comment, the characters // 
593 introduce a comment that includes all characters up to, but not including, the next 
594 new-line character.  The contents of such a comment are examined only to identify 
595 characters and to find the terminating new-line characters.
596 \linebreak
597
598 %% -> Expressions %%
599 \subsection{Expressions}
600 An expression is a sequence of operators and operands that specifies computation of a 
601 value, or that designates an object or function, or that generates side effects, or that 
602 performs a combination thereof.
603 \linebreak
604
605 Between the previous and next sequence point an object shall have its stored value 
606 modified at most once by the evaluation of an expression. Furthermore, the prior value 
607 shall be read only to determine the value to be stored.
608 \linebreak
609
610 The grouping of operators and operands is indicated by the syntax. Except as specified 
611 later (for the function call (), \&\&, \textbar\textbar ?:, and comma operators), the 
612 order of evaluation of sub-expressions and the order in which side effects take place 
613 are both unspecified.
614 \linebreak
615
616 Some operators (the unary \textasciitilde operator, and the binary operators \textless
617 \textless, \textgreater\textgreater, \&, \^, and \textbar, collectively describe bitwise 
618 operators) are required to have operands that are either integer, or floating point with
619 zero points of decimal precision.
620 \linebreak
621
622 If an exceptional condition occurs during the evaluation of an expression (that is, if 
623 the result is not mathematically defined or not in the range or representable values for 
624 its type), the behavior is undefined.
625
626 %% ->-> Primary expressions %%
627 \subsubsection{Primary expressions}
628 \paragraph*{Syntax}
629 \begin{lstlisting}[language=bnf]
630 primary-expression := identifier
631                     | constant
632                     | string-literal
633                     ( expression )
634 \end{lstlisting}
635 \paragraph*{Semantics}
636 An identifier is a primary expression, provided it has been declared as designating an 
637 object(in which case it is an lvalye) or a function(in which case it is a function 
638 designator).
639 \linebreak
640
641 A constant is a primary expression. Its type depends on its form and value.
642 \linebreak
643
644 A string literal is a primary expression.  It is an lvalue.
645 \linebreak
646
647 A parenthesized expression is a primary expression.  Its type and value identical to 
648 those of the unparenthesized expression.  It is an lvalue, a function designator, or a 
649 void expression if the unparenthesized expression is, respectively, an lvalue, a 
650 function designator, or a void expression.
651
652 \bibliographystyle{abbrv}
653 \bibliography{main}
654
655 \end{document}