Changes in / [e85a8631:04cdd9b]
- Files:
-
- 18 edited
-
doc/aaron_comp_II/comp_II.tex (modified) (26 diffs)
-
src/Common/Assert.cc (modified) (3 diffs)
-
src/Common/utility.h (modified) (1 diff)
-
src/Makefile.am (modified) (2 diffs)
-
src/Makefile.in (modified) (1 diff)
-
src/Parser/DeclarationNode.cc (modified) (2 diffs)
-
src/Parser/ExpressionNode.cc (modified) (5 diffs)
-
src/Parser/InitializerNode.cc (modified) (1 diff)
-
src/Parser/ParseNode.h (modified) (3 diffs)
-
src/Parser/StatementNode.cc (modified) (2 diffs)
-
src/Parser/TypeData.cc (modified) (1 diff)
-
src/Parser/parser.cc (modified) (3 diffs)
-
src/Parser/parser.yy (modified) (2 diffs)
-
src/SynTree/Expression.cc (modified) (1 diff)
-
src/SynTree/FunctionDecl.cc (modified) (1 diff)
-
src/SynTree/Statement.cc (modified) (4 diffs)
-
src/include/assert.h (modified) (3 diffs)
-
src/main.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/aaron_comp_II/comp_II.tex
re85a8631 r04cdd9b 91 91 \CFA\footnote{Pronounced ``C-for-all'', and written \CFA or \CFL.} is an evolutionary modernization of the C programming language currently being designed and built at the University of Waterloo by a team led by Peter Buhr. 92 92 \CFA both fixes existing design problems and adds multiple new features to C, including name overloading, user-defined operators, parametric-polymorphic routines, and type constructors and destructors, among others. 93 The new features make \CFA more powerful and expressive than C, but impose a compile-time cost, particularly in the expression resolver, which must evaluate the typing rules of a significantlymore complex type-system.93 The new features make \CFA significantly more powerful and expressive than C, but impose a significant compile-time cost, particularly in the expression resolver, which must evaluate the typing rules of a much more complex type-system. 94 94 95 95 The primary goal of this research project is to develop a sufficiently performant expression resolution algorithm, experimentally validate its performance, and integrate it into CFA, the \CFA reference compiler. … … 104 104 105 105 It is important to note that \CFA is not an object-oriented language. 106 \CFA does have a system of (possibly implicit) type conversions derived from C's type conversions; while these conversions may be thought of as something like an inheritance hierarchy ,the underlying semantics are significantly different and such an analogy is loose at best.106 \CFA does have a system of (possibly implicit) type conversions derived from C's type conversions; while these conversions may be thought of as something like an inheritance hierarchy the underlying semantics are significantly different and such an analogy is loose at best. 107 107 Particularly, \CFA has no concept of ``subclass'', and thus no need to integrate an inheritance-based form of polymorphism with its parametric and overloading-based polymorphism. 108 108 The graph structure of the \CFA type conversions is also markedly different than an inheritance graph; it has neither a top nor a bottom type, and does not satisfy the lattice properties typical of inheritance graphs. … … 120 120 \end{lstlisting} 121 121 The ©identity© function above can be applied to any complete object type (or ``©otype©''). 122 The type variable ©T© is transformed into a set of additional implicit parameters to ©identity© ,which encode sufficient information about ©T© to create and return a variable of that type.122 The type variable ©T© is transformed into a set of additional implicit parameters to ©identity© which encode sufficient information about ©T© to create and return a variable of that type. 123 123 The current \CFA implementation passes the size and alignment of the type represented by an ©otype© parameter, as well as an assignment operator, constructor, copy constructor and destructor. 124 124 Here, the runtime cost of polymorphism is spread over each polymorphic call, due to passing more arguments to polymorphic functions; preliminary experiments have shown this overhead to be similar to \CC virtual function calls. 125 125 Determining if packaging all polymorphic arguments to a function into a virtual function table would reduce the runtime overhead of polymorphic calls is an open research question. 126 126 127 Since bare polymorphic types do not provide a great range of available operations, \CFA provides a \emph{type assertion} mechanism to provide further information about a type:127 Since bare polymorphic types do not provide a great range of available operations, \CFA also provides a \emph{type assertion} mechanism to provide further information about a type: 128 128 \begin{lstlisting} 129 129 forall(otype T ®| { T twice(T); }®) … … 137 137 \end{lstlisting} 138 138 These type assertions may be either variable or function declarations that depend on a polymorphic type variable. 139 ©four_times© can only be called with an argument for which there exists a function named ©twice© that can take that argument and return another value of the same type; a pointer to the appropriate ©twice© function is passed as an additional implicit parameter to the call of©four_times©.139 ©four_times© can only be called with an argument for which there exists a function named ©twice© that can take that argument and return another value of the same type; a pointer to the appropriate ©twice© function is passed as an additional implicit parameter to the call to ©four_times©. 140 140 141 141 Monomorphic specializations of polymorphic functions can themselves be used to satisfy type assertions. … … 148 148 The compiler accomplishes this by creating a wrapper function calling ©twice // (2)© with ©S© bound to ©double©, then providing this wrapper function to ©four_times©\footnote{©twice // (2)© could also have had a type parameter named ©T©; \CFA specifies renaming of the type parameters, which would avoid the name conflict with the type variable ©T© of ©four_times©.}. 149 149 150 Finding appropriate functions to satisfy type assertions is essentially a recursive case of expression resolution, as it takes a name (that of the type assertion) and attempts to match it to a suitable declaration \emph{in the current scope}.150 Finding appropriate functions to satisfy type assertions is essentially a recursive case of expression resolution, as it takes a name (that of the type assertion) and attempts to match it to a suitable declaration in the current scope. 151 151 If a polymorphic function can be used to satisfy one of its own type assertions, this recursion may not terminate, as it is possible that function is examined as a candidate for its own type assertion unboundedly repeatedly. 152 152 To avoid infinite loops, the current CFA compiler imposes a fixed limit on the possible depth of recursion, similar to that employed by most \CC compilers for template expansion; this restriction means that there are some semantically well-typed expressions that cannot be resolved by CFA. … … 170 170 forall(otype M | has_magnitude(M)) 171 171 M max_magnitude( M a, M b ) { 172 return abs(a) < abs(b) ? b : a; 172 M aa = abs(a), ab = abs(b); 173 return aa < ab ? b : a; 173 174 } 174 175 \end{lstlisting} 175 176 176 177 Semantically, traits are simply a named lists of type assertions, but they may be used for many of the same purposes that interfaces in Java or abstract base classes in \CC are used for. 177 Unlike Java interfaces or \CC base classes, \CFA types do not explicitly state any inheritance relationship to traits they satisfy; this can be considered a form of structural inheritance, similar to i mplementation of an interfacein Go, as opposed to the nominal inheritance model of Java and \CC.178 Unlike Java interfaces or \CC base classes, \CFA types do not explicitly state any inheritance relationship to traits they satisfy; this can be considered a form of structural inheritance, similar to interface implementation in Go, as opposed to the nominal inheritance model of Java and \CC. 178 179 Nominal inheritance can be simulated with traits using marker variables or functions: 179 180 \begin{lstlisting} … … 189 190 \end{lstlisting} 190 191 191 Traits, however, are significantly more powerful than nominal-inheritance interfaces; firstly, due to the scoping rules of the declarations thatsatisfy a trait's type assertions, a type may not satisfy a trait everywhere that the type is declared, as with ©char© and the ©nominal© trait above.192 Secondly, traits may be used to declare a relationship among multiple types, a property thatmay be difficult or impossible to represent in nominal-inheritance type systems:192 Traits, however, are significantly more powerful than nominal-inheritance interfaces; firstly, due to the scoping rules of the declarations which satisfy a trait's type assertions, a type may not satisfy a trait everywhere that the type is declared, as with ©char© and the ©nominal© trait above. 193 Secondly, traits may be used to declare a relationship between multiple types, a property which may be difficult or impossible to represent in nominal-inheritance type systems: 193 194 \begin{lstlisting} 194 195 trait pointer_like(®otype Ptr, otype El®) { … … 201 202 }; 202 203 203 typedef list *list_iterator;204 typedef list* list_iterator; 204 205 205 206 lvalue int *?( list_iterator it ) { … … 208 209 \end{lstlisting} 209 210 210 In the example above, ©(list_iterator, int)© satisfies ©pointer_like© by the user-defined dereference function, and ©(list_iterator, list)© also satisfies ©pointer_like© by the built-in dereference operator for pointers. 211 Given a declaration ©list_iterator it©, ©*it© can be either an ©int© or a ©list©, with the meaning disambiguated by context (\eg ©int x = *it;© interprets ©*it© as an ©int©, while ©(*it).value = 42;© interprets ©*it© as a ©list©). 211 In the example above, ©(list_iterator, int)© satisfies ©pointer_like© by the given function, and ©(list_iterator, list)© also satisfies ©pointer_like© by the built-in pointer dereference operator. 212 212 While a nominal-inheritance system with associated types could model one of those two relationships by making ©El© an associated type of ©Ptr© in the ©pointer_like© implementation, few such systems could model both relationships simultaneously. 213 213 214 The flexibility of \CFA's implicit trait -satisfaction mechanism provides programmers with a great deal of power, but also blocks some optimization approaches for expression resolution.215 The ability of types to begin to or cease to satisfy traits when declarations go into or out of scope makes caching of trait satisfaction judgements difficult, and the ability of traits to take multiple type parameters c anlead to a combinatorial explosion of work in any attempt to pre-compute trait satisfaction relationships.214 The flexibility of \CFA's implicit trait satisfaction mechanism provides programmers with a great deal of power, but also blocks some optimization approaches for expression resolution. 215 The ability of types to begin to or cease to satisfy traits when declarations go into or out of scope makes caching of trait satisfaction judgements difficult, and the ability of traits to take multiple type parameters could lead to a combinatorial explosion of work in any attempt to pre-compute trait satisfaction relationships. 216 216 On the other hand, the addition of a nominal inheritance mechanism to \CFA's type system or replacement of \CFA's trait satisfaction system with a more object-oriented inheritance model and investigation of possible expression resolution optimizations for such a system may be an interesting avenue of further research. 217 217 218 218 \subsection{Name Overloading} 219 219 In C, no more than one variable or function in the same scope may share the same name\footnote{Technically, C has multiple separated namespaces, one holding ©struct©, ©union©, and ©enum© tags, one holding labels, one holding typedef names, variable, function, and enumerator identifiers, and one for each ©struct© or ©union© type holding the field names.}, and variable or function declarations in inner scopes with the same name as a declaration in an outer scope hide the outer declaration. 220 This restriction makes finding the proper declaration to match to a variable expression or function application a simple matter of symbol-table lookup, which can be easily and efficiently implemented.220 This makes finding the proper declaration to match to a variable expression or function application a simple matter of symbol table lookup, which can be easily and efficiently implemented. 221 221 \CFA, on the other hand, allows overloading of variable and function names, so long as the overloaded declarations do not have the same type, avoiding the multiplication of variable and function names for different types common in the C standard library, as in the following example: 222 222 \begin{lstlisting} … … 229 229 double max = DBL_MAX; // (4) 230 230 231 max(7, -max); // uses (1) and (3), by matching int type of the constant7232 max(max, 3.14); // uses (2) and (4), by matching double type of the constant3.14231 max(7, -max); // uses (1) and (3), by matching int type of 7 232 max(max, 3.14); // uses (2) and (4), by matching double type of 3.14 233 233 234 234 max(max, -max); // ERROR: ambiguous 235 int m = max(max, -max); // uses (1) once and (3) twice, by matchingreturn type235 int m = max(max, -max); // uses (1) and (3) twice, by return type 236 236 \end{lstlisting} 237 237 … … 239 239 240 240 \subsection{Implicit Conversions} 241 In addition to the multiple interpretations of an expression produced by name overloading, \CFA must support all of the implicit conversions present in C for backward compatibility, producing further candidate interpretations for expressions.242 C does not have a inheritance hierarchy of types, but the C standard's rules for the ``usual arithmetic conversions'' define which of the built-in types are implicitly convertable to which other types, and the relative cost of any pair of such conversions from a single source type.243 \CFA adds to the usual arithmetic conversions rules defining the cost of binding a polymorphic type variable in a function call; such bindings are cheaper than any \emph{unsafe} (narrowing) conversion, \eg ©int© to ©char©, but more expensive than any \emph{safe} (widening) conversion, \eg ©int© to ©double©.244 245 The expression resolution problem, then, is to find the unique minimal-cost interpretation of each expression in the program, where all identifiers must be matched to a declaration ,and implicit conversions or polymorphic bindings of the result of an expression may increase the cost of the expression.241 In addition to the multiple interpretations of an expression produced by name overloading, \CFA also supports all of the implicit conversions present in C, producing further candidate interpretations for expressions. 242 C does not have a traditionally-defined inheritance hierarchy of types, but the C standard's rules for the ``usual arithmetic conversions'' define which of the built-in types are implicitly convertable to which other types, and the relative cost of any pair of such conversions from a single source type. 243 \CFA adds to the usual arithmetic conversions rules for determining the cost of binding a polymorphic type variable in a function call; such bindings are cheaper than any \emph{unsafe} (narrowing) conversion, \eg ©int© to ©char©, but more expensive than any \emph{safe} (widening) conversion, \eg ©int© to ©double©. 244 245 The expression resolution problem, then, is to find the unique minimal-cost interpretation of each expression in the program, where all identifiers must be matched to a declaration and implicit conversions or polymorphic bindings of the result of an expression may increase the cost of the expression. 246 246 Note that which subexpression interpretation is minimal-cost may require contextual information to disambiguate. 247 For instance, in the example in the previous subsection, ©max(max, -max)© cannot be unambiguously resolved, but ©int m = max(max, -max) © has a single minimal-cost resolution.248 While the interpretation ©int m = (int)max((double)max, -(double)max)© is also a valid interpretation, it is not minimal-cost due to the unsafe cast from the ©double© result of ©max© to ©int© (the two ©double© casts function as type ascriptions selecting ©double max© rather than casts from ©int max© to ©double©, and as such are zero-cost).247 For instance, in the example in the previous subsection, ©max(max, -max)© cannot be unambiguously resolved, but ©int m = max(max, -max);© has a single minimal-cost resolution. 248 ©int m = (int)max((double)max, -(double)max)© is also be a valid interpretation, but is not minimal-cost due to the unsafe cast from the ©double© result of ©max© to ©int© (the two ©double© casts function as type ascriptions selecting ©double max© rather than casts from ©int max© to ©double©, and as such are zero-cost). 249 249 250 250 \subsubsection{User-generated Implicit Conversions} … … 252 252 Such a conversion system should be simple for programmers to utilize, and fit naturally with the existing design of implicit conversions in C; ideally it would also be sufficiently powerful to encode C's usual arithmetic conversions itself, so that \CFA only has one set of rules for conversions. 253 253 254 Ditchfield~\cite{Ditchfield:conversions} laid out a framework for using polymorphic-conversion-constructor functions to create a directed acyclic graph (DAG) of conversions.254 Ditchfield~\cite{Ditchfield:conversions} has laid out a framework for using polymorphic-conversion-constructor functions to create a directed acyclic graph (DAG) of conversions. 255 255 A monomorphic variant of these functions can be used to mark a conversion arc in the DAG as only usable as the final step in a conversion. 256 With these two types of conversion arcs, separate DAGs can be created for the safe and the unsafe conversions, and conversion cost can be represented the length of the shortest path through the DAG from one type to another.256 With these two types of conversion arcs, separate DAGs can be created for the safe and the unsafe conversions, and conversion cost can be represented as path length through the DAG. 257 257 \begin{figure}[h] 258 258 \centering 259 259 \includegraphics{conversion_dag} 260 \caption{A portion of the implicit conversion DAG for built-in types.} \label{fig:conv_dag}260 \caption{A portion of the implicit conversion DAG for built-in types.} 261 261 \end{figure} 262 As can be seen in Figure~\ref{fig:conv_dag}, there are either safe or unsafe paths between each of the arithmetic types listed; the ``final'' arcs are important both to avoid creating cycles in the signed-unsigned conversions, and to disambiguate potential diamond conversions (\eg, if the ©int© to ©unsigned int© conversion was not marked final there would be two length-two paths from ©int© to ©unsigned long©, making itimpossible to choose which one; however, since the ©unsigned int© to ©unsigned long© arc can not be traversed after the final ©int© to ©unsigned int© arc, there is a single unambiguous conversion path from ©int© to ©unsigned long©).262 As can be seen in the example DAG above, there are either safe or unsafe paths between each of the arithmetic types listed; the ``final'' arcs are important both to avoid creating cycles in the signed-unsigned conversions, and to disambiguate potential diamond conversions (\eg, if the ©int© to ©unsigned int© conversion was not marked final there would be two length-two paths from ©int© to ©unsigned long©, and it would be impossible to choose which one; however, since the ©unsigned int© to ©unsigned long© arc can not be traversed after the final ©int© to ©unsigned int© arc, there is a single unambiguous conversion path from ©int© to ©unsigned long©). 263 263 264 264 Open research questions on this topic include: 265 265 \begin{itemize} 266 266 \item Can a conversion graph be generated that represents each allowable conversion in C with a unique minimal-length path such that the path lengths accurately represent the relative costs of the conversions? 267 \item Can such a graph representation be usefully augmented to include user-defined types as well as built-in types?268 \item Can the graph be efficiently represented and used in the expression resolver?267 \item Can such a graph representation can be usefully augmented to include user-defined types as well as built-in types? 268 \item Can the graph can be efficiently represented and used in the expression resolver? 269 269 \end{itemize} 270 270 271 271 \subsection{Constructors and Destructors} 272 272 Rob Shluntz, a current member of the \CFA research team, has added constructors and destructors to \CFA. 273 Each type has an overridable default-generated zero-argument constructor, copy constructor, assignment operator, and destructor. 274 For ©struct© types these functions each call their equivalents on each field of the ©struct©. 275 This feature affects expression resolution because an ©otype© type variable ©T© implicitly adds four type assertions, one for each of these four functions, so assertion resolution is pervasive in \CFA polymorphic functions, even those without any explicit type assertions. 273 Each type has an overridable default-generated zero-argument constructor, copy constructor, assignment operator, and destructor; for ©struct© types these functions each call their equivalents on each field of the ©struct©. 274 This affects expression resolution because an ©otype© type variable ©T© implicitly adds four type assertions, one for each of these four functions, so assertion resolution is pervasive in \CFA polymorphic functions, even those without any explicit type assertions. 276 275 The following example shows the implicitly-generated code in green: 277 276 \begin{lstlisting} … … 281 280 }; 282 281 283 ¢void ?{}(kv *this) { // default constructor284 ?{}(& (this->key)); // call recursively on members285 ?{}(& (this->value));286 } 287 void ?{}(kv *this, kv that) { // copy constructor288 ?{}(& (this->key), that.key);289 ?{}(& (this->value), that.value);290 } 291 kv ?=?(kv *this, kv that) { // assignment operator292 ?=?(& (this->key), that.key);293 ?=?(& (this->value), that.value);282 ¢void ?{}(kv *this) { 283 ?{}(&this->key); 284 ?{}(&this->value); 285 } 286 void ?{}(kv *this, kv that) { 287 ?{}(&this->key, that.key); 288 ?{}(&this->value, that.value); 289 } 290 kv ?=?(kv *this, kv that) { 291 ?=?(&this->key, that.key); 292 ?=?(&this->value, that.value); 294 293 return *this; 295 294 } 296 void ^?{}(kv *this) { // destructor297 ^?{}(& (this->key));298 ^?{}(& (this->value));295 void ^?{}(kv *this) { 296 ^?{}(&this->key); 297 ^?{}(&this->value); 299 298 }¢ 300 299 … … 336 335 \begin{itemize} 337 336 \item Since there is an implicit conversion from ©void*© to any pointer type, the highlighted expression can be interpreted as either a ©void*©, matching ©f // (1)©, or a ©box(S)*© for some type ©S©, matching ©f // (2)©. 338 \item To determine the cost of the ©box(S)© interpretation, a type must be found for ©S© thatsatisfies the ©otype© implicit type assertions (assignment operator, default and copy constructors, and destructor); one option is ©box(S2)© for some type ©S2©.337 \item To determine the cost of the ©box(S)© interpretation, a type must be found for ©S© which satisfies the ©otype© implicit type assertions (assignment operator, default and copy constructors, and destructor); one option is ©box(S2)© for some type ©S2©. 339 338 \item The assignment operator, default and copy constructors, and destructor of ©box(T)© are also polymorphic functions, each of which require the type parameter ©T© to have an assignment operator, default and copy constructors, and destructor. When choosing an interpretation for ©S2©, one option is ©box(S3)©, for some type ©S3©. 340 339 \item The previous step repeats until stopped, with four times as much work performed at each step. 341 340 \end{itemize} 342 This problem can occur in any resolution context where a polymorphic function can satisfy its own type assertions is required for a possible interpretation of an expression with no constraints on its type, and is thus not limited to combinations of generic types with ©void*© conversions. 343 However, constructors for generic types often satisfy their own assertions and a polymorphic conversion such as the ©void*© conversion to a polymorphic variable is a common way to create an expression with no constraints on its type. 341 This problem can occur in any resolution context where a polymorphic function that can satisfy its own type assertions is required for a possible interpretation of an expression with no constraints on its type, and is thus not limited to combinations of generic types with ©void*© conversions, though constructors for generic types often satisfy their own assertions and a polymorphic conversion such as the ©void*© conversion to a polymorphic variable can create an expression with no constraints on its type. 344 342 As discussed above, the \CFA expression resolver must handle this possible infinite recursion somehow, and it occurs fairly naturally in code like the above that uses generic types. 345 343 … … 347 345 \CFA adds \emph{tuple types} to C, a syntactic facility for referring to lists of values anonymously or with a single identifier. 348 346 An identifier may name a tuple, and a function may return one. 349 Particularly relevantly for resolution, a tuple may be implicitly \emph{destructured} into a list of values, as in the call to ©swap© :350 \begin{lstlisting} 351 [char, char] x = [ '!', '?' ]; // (1)352 int x = 42; // (2)353 354 forall(otype T) [T, T] swap( T a, T b ) { return [b, a]; } // (3)347 Particularly relevantly for resolution, a tuple may be implicitly \emph{destructured} into a list of values, as in the call to ©swap© below: 348 \begin{lstlisting} 349 [char, char] x = [ '!', '?' ]; 350 int x = 42; 351 352 forall(otype T) [T, T] swap( T a, T b ) { return [b, a]; } 355 353 356 354 x = swap( x ); // destructure [char, char] x into two elements of parameter list 357 355 // cannot use int x for parameter, not enough arguments to swap 358 359 void swap( int, char, char ); // (4) 360 361 swap( x, x ); // resolved as (4) on (2) and (1) 362 // (3) on (2) and (2) is close, but the polymorphic binding makes it not minimal-cost 363 \end{lstlisting} 364 Tuple destructuring means that the mapping from the position of a subexpression in the argument list to the position of a paramter in the function declaration is not straightforward, as some arguments may be expandable to different numbers of parameters, like ©x© above. 365 In the second example, the second ©x© argument can be resolved starting at the second or third parameter of ©swap©, depending which interpretation of ©x© was chosen for the first argument. 356 \end{lstlisting} 357 Tuple destructuring means that the mapping from the position of a subexpression in the argument list to the position of a paramter in the function declaration is not straightforward, as some arguments may be expandable to different numbers of parameters, like ©x© above. 366 358 367 359 \subsection{Reference Types} 368 360 I have been designing \emph{reference types} for \CFA, in collaboration with the rest of the \CFA research team. 369 361 Given some type ©T©, a ©T&© (``reference to ©T©'') is essentially an automatically dereferenced pointer; with these semantics most of the C standard's discussions of lvalues can be expressed in terms of references instead, with the benefit of being able to express the difference between the reference and non-reference version of a type in user code. 370 References preserve C's existing qualifier-dropping lvalue-to-rvalue conversion (\eg a ©const volatile int&© can be implicitly converted to a bare ©int©). 371 The reference proposal also adds a rvalue-to-lvalue conversion to \CFA, implemented by storing the value in a new compiler-generated temporary and passing a reference to the temporary. 372 These two conversions can chain, producing a qualifier-dropping conversion for references, for instance converting a reference to a ©const int© into a reference to a non-©const int© by copying the originally refered to value into a fresh temporary and taking a reference to this temporary, as in: 362 References preserve C's existing qualifier-dropping lvalue-to-rvalue conversion (\eg a ©const volatile int&© can be implicitly converted to a bare ©int©); the reference proposal also adds a rvalue-to-lvalue conversion to \CFA, implemented by storing the value in a new compiler-generated temporary and passing a reference to the temporary. 363 These two conversions can chain, producing a qualifier-dropping conversion for references, for instance converting a reference to a ©const int© into a reference to a non-©const int© by copying the originally refered to value into a fresh temporary and taking a reference to this temporary, as below: 373 364 \begin{lstlisting} 374 365 const int magic = 42; … … 378 369 print_inc( magic ); // legal; implicitly generated code in green below: 379 370 380 ¢int tmp = magic;¢ // to safely strip const-qualifier371 ¢int tmp = magic;¢ // copies to safely strip const-qualifier 381 372 ¢print_inc( tmp );¢ // tmp is incremented, magic is unchanged 382 373 \end{lstlisting} 383 These reference conversions may also chain with the other implicit type -conversions.384 The main implication of th e reference conversions for expression resolution is the multiplication of available implicit conversions, though given the restricted context reference conversions may be able to be treated efficiently as a special case of implicit conversions.374 These reference conversions may also chain with the other implicit type conversions. 375 The main implication of this for expression resolution is the multiplication of available implicit conversions, though in a restricted context that may be able to be treated efficiently as a special case. 385 376 386 377 \subsection{Special Literal Types} 387 378 Another proposal currently under consideration for the \CFA type-system is assigning special types to the literal values ©0© and ©1©. 388 Implicit conversions from these types allow ©0© and ©1© to be considered as values of many different types, depending on context, allowing expression desugarings like ©if ( x ) {}© $\Rightarrow$ ©if ( x != 0 ) {}© to be implemented efficiently and preci sely.379 Implicit conversions from these types allow ©0© and ©1© to be considered as values of many different types, depending on context, allowing expression desugarings like ©if ( x ) {}© $\Rightarrow$ ©if ( x != 0 ) {}© to be implemented efficiently and precicely. 389 380 This approach is a generalization of C's existing behaviour of treating ©0© as either an integer zero or a null pointer constant, and treating either of those values as boolean false. 390 381 The main implication for expression resolution is that the frequently encountered expressions ©0© and ©1© may have a large number of valid interpretations. … … 395 386 int somefn(char) = delete; 396 387 \end{lstlisting} 397 This feature is typically used in \CCeleven to make a type non-copyable by deleting its copy constructor and assignment operator \footnote{In previous versions of \CC a type could be made non-copyable by declaring a private copy constructor and assignment operator, but not defining either. This idiom is well-known, but depends on some rather subtle and \CC-specific rules about private members and implicitly-generated functions; the deleted-function form is both clearer and less verbose.}, or forbidding some interpretations of a polymorphic function by specifically deleting the forbidden overloads\footnote{Specific polymorphic function overloads can also be forbidden in previous \CC versions through use of template metaprogramming techniques, though this advanced usage is beyond the skills of many programmers. A similar effect can be produced on an ad-hoc basis at the appropriate call sites through use of casts to determine the function type. In both cases, the deleted-function form is clearer and more concise.}.398 To add a similar feature to \CFA involves including the deleted function declarations in expression resolution along with the normal declarations, but producing a compiler error if the deleted function is the best resolution.388 This feature is typically used in \CCeleven to make a type non-copyable by deleting its copy constructor and assignment operator, or forbidding some interpretations of a polymorphic function by specifically deleting the forbidden overloads. 389 To add a similar feature to \CFA would involve including the deleted function declarations in expression resolution along with the normal declarations, but producing a compiler error if the deleted function was the best resolution. 399 390 How conflicts should be handled between resolution of an expression to both a deleted and a non-deleted function is a small but open research question. 400 391 … … 413 404 %TODO: look up and lit review 414 405 The second area of investigation is minimizing dependencies between argument-parameter matches; the current CFA compiler attempts to match entire argument combinations against functions at once, potentially attempting to match the same argument against the same parameter multiple times. 415 Whether the feature set of \CFA admits an expression resolution algorithm where arguments can be matched to parameters independently of other arguments in the same function application is an area of open research; polymorphic type paramters produce enough cross-argument dependenciesthat the problem is not trivial.406 Whether the feature set of \CFA admits an expression resolution algorithm where arguments can be matched to parameters independently of other arguments in the same function application is an area of open research; polymorphic type paramters produce enough of a cross-argument dependency that the problem is not trivial. 416 407 If cross-argument resolution dependencies cannot be completely eliminated, effective caching strategies to reduce duplicated work between equivalent argument-parameter matches in different combinations may mitigate the asymptotic defecits of the whole-combination matching approach. 417 408 The final area of investigation is heuristics and algorithmic approaches to reduce the number of argument interpretations considered in the common case; if argument-parameter matches cannot be made independent, even small reductions in $i$ should yield significant reductions in the $i^{p+1}$ resolver runtime factor. … … 421 412 422 413 \subsection{Argument-Parameter Matching} 423 The first axis for consideration is theargument-parameter matching direction --- whether the type matching for a candidate function to a set of candidate arguments is directed by the argument types or the parameter types.414 The first axis for consideration is argument-parameter matching direction --- whether the type matching for a candidate function to a set of candidate arguments is directed by the argument types or the parameter types. 424 415 For programming languages without implicit conversions, argument-parameter matching is essentially the entirety of the expression resolution problem, and is generally referred to as ``overload resolution'' in the literature. 425 All expression -resolution algorithms form a DAG of interpretations, some explicitly, some implicitly; in this DAG, arcs point from function-call interpretations to argument interpretations, as in Figure~\ref{fig:res_dag}:416 All expression resolution algorithms form a DAG of interpretations, some explicitly, some implicitly; in this DAG, arcs point from function-call interpretations to argument interpretations, as below: 426 417 \begin{figure}[h] 427 418 \centering … … 442 433 \end{figure} 443 434 444 Note that some interpretations may be part of more than one super-interpretation, as with the second $p_i$ in the bottom row, while some valid subexpression interpretations, like $f_d$ in the middle row, are not used in any interpretation of their superexpression.435 Note that some interpretations may be part of more than one super-interpretation, as with $p_i$ in the bottom row, while some valid subexpression interpretations, like $f_d$ in the middle row, are not used in any interpretation of their containing expression. 445 436 446 437 \subsubsection{Argument-directed (Bottom-up)} … … 460 451 A reasonable hybrid approach might take a top-down approach when the expression to be matched has a fixed type, and a bottom-up approach in untyped contexts. 461 452 This approach may involve switching from one type to another at different levels of the expression tree. 462 For instance , in:453 For instance: 463 454 \begin{lstlisting} 464 455 forall(otype T) … … 469 460 int x = f( f( '!' ) ); 470 461 \end{lstlisting} 471 the outer call to ©f© must have a return type that is (implicitly convertable to) ©int©, so a top-down approach is used to select \textit{(1)} as the proper interpretation of ©f©. \textit{(1)}'s parameter ©x©, however, is an unbound type variable, and can thus take a value of any complete type, providing no guidance for the choice of candidate for the inner call to ©f©. The leaf expression ©'!'©, however, determines a zero-cost interpretation of the inner ©f© as \textit{(2)}, providing a minimal-cost expression resolution where ©T© is bound to ©void*©. 472 473 Deciding when to switch between bottom-up and top-down resolution to minimize wasted work in a hybrid algorithm is a necessarily heuristic process, and finding good heuristics for which subexpressions to swich matching strategies on is an open question. 474 One reasonable approach might be to set a threshold $t$ for the number of candidate functions, and to use top-down resolution for any subexpression with fewer than $t$ candidate functions, to minimize the number of unmatchable argument interpretations computed, but to use bottom-up resolution for any subexpression with at least $t$ candidate functions, to reduce duplication in argument interpretation computation between the different candidate functions. 462 The outer call to ©f© must have a return type that is (implicitly convertable to) ©int©, so a top-down approach is used to select \textit{(1)} as the proper interpretation of ©f©. \textit{(1)}'s parameter ©x©, however, is an unbound type variable, and can thus take a value of any complete type, providing no guidance for the choice of candidate for the inner call to ©f©. The leaf expression ©'!'©, however, determines a zero-cost interpretation of the inner ©f© as \textit{(2)}, providing a minimal-cost expression resolution where ©T© is bound to ©void*©. 463 464 Deciding when to switch between bottom-up and top-down resolution to minimize wasted work in a hybrid algorithm is a necessarily heuristic process, and though finding good heuristics for which subexpressions to swich matching strategies on is an open question, one reasonable approach might be to set a threshold $t$ for the number of candidate functions, and to use top-down resolution for any subexpression with fewer than $t$ candidate functions, to minimize the number of unmatchable argument interpretations computed, but to use bottom-up resolution for any subexpression with at least $t$ candidate functions, to reduce duplication in argument interpretation computation between the different candidate functions. 475 465 476 466 Ganzinger and Ripken~\cite{Ganzinger80} propose an approach (later refined by Pennello~\etal~\cite{Pennello80}) that uses a top-down filtering pass followed by a bottom-up filtering pass to reduce the number of candidate interpretations; they prove that for the Ada programming language a small number of such iterations is sufficient to converge to a solution for the expression resolution problem. 477 467 Persch~\etal~\cite{PW:overload} developed a similar two-pass approach where the bottom-up pass is followed by the top-down pass. 478 These algorithms differ from the hybrid approach under investigation in that they take multiple passes over the expression tree to yield a solution, and that they alsoapply both filtering heuristics to all expression nodes; \CFA's polymorphic functions and implicit conversions make the approach of filtering out invalid types taken by all of these algorithms infeasible.468 These algorithms differ from the hybrid approach under investigation in that they take multiple passes over the expression tree to yield a solution, and also in that they apply both filtering heuristics to all expression nodes; \CFA's polymorphic functions and implicit conversions make the approach of filtering out invalid types taken by all of these algorithms infeasible. 479 469 480 470 \subsubsection{Common Subexpression Caching} … … 490 480 \CC~\cite{ANSI98:C++} includes both name overloading and implicit conversions in its expression resolution specification, though unlike \CFA it does complete type-checking on a generated monomorphization of template functions, where \CFA simply checks a list of type constraints. 491 481 The upcoming Concepts standard~\cite{C++concepts} defines a system of type constraints similar in principle to \CFA's. 492 Cormack and Wright~\cite{Cormack90} present an algorithm thatintegrates overload resolution with a polymorphic type inference approach very similar to \CFA's.482 Cormack and Wright~\cite{Cormack90} present an algorithm which integrates overload resolution with a polymorphic type inference approach very similar to \CFA's. 493 483 However, their algorithm does not account for implicit conversions other than polymorphic type binding and their discussion of their overload resolution algorithm is not sufficiently detailed to classify it with the other argument-parameter matching approaches\footnote{Their overload resolution algorithm is possibly a variant of Ganzinger and Ripken~\cite{Ganzinger80} or Pennello~\etal~\cite{Pennello80}, modified to allow for polymorphic type binding.}. 494 484 … … 496 486 Bilson does account for implicit conversions in his algorithm, but it is unclear if the approach is optimal. 497 487 His algorithm integrates checking for valid implicit conversions into the argument-parameter-matching step, essentially trading more expensive matching for a smaller number of argument interpretations. 498 This approach may result in the same subexpression being checked for a type match with the same type multiple times, though again memoization may mitigate this cost; however, this approach does not generate implicit conversions that are not useful to match the containing function. 488 This approach may result in the same subexpression being checked for a type match with the same type multiple times, though again memoization may mitigate this cost, and this approach does not generate implicit conversions that are not useful to match the containing function. 489 Calculating implicit conversions on parameters pairs naturally with a top-down approach to expression resolution, though it can also be used in a bottom-up approach, as Bilson demonstrates. 499 490 500 491 \subsubsection{On Arguments} 501 492 Another approach is to generate a set of possible implicit conversions for each set of interpretations of a given argument. 502 493 This approach has the benefit of detecting ambiguous interpretations of arguments at the level of the argument rather than its containing call, never finds more than one interpretation of the argument with a given type, and re-uses calculation of implicit conversions between function candidates. 503 On the other hand, this approach may unnecessarily generate argument interpretations that never match any parameter, wasting work. 504 Furthermore, in the presence of tuple types, this approach may lead to a combinatorial explosion of argument interpretations considered, unless the tuple can be considered as a sequence of elements rather than a unified whole. 494 On the other hand, this approach may unncessarily generate argument interpretations that never match any parameter, wasting work. 495 Further, in the presence of tuple types this approach may lead to a combinatorial explosion of argument interpretations considered, unless the tuple can be considered as a sequence of elements rather than a unified whole. 496 Calculating implicit conversions on arguments is a viable approach for bottom-up expression resolution, though it may be difficult to apply in a top-down approach due to the presence of a target type for the expression interpretation. 505 497 506 498 \subsection{Candidate Set Generation} 507 All the algorithms discussed to this point generate the complete set of candidate argument interpretations before attempting to match the containing function -call expression.508 However, given that the top-level expression interpretation that is ultimately chosen is the minimal-cost valid interpretation, any consideration of non-minimal-cost interpretations is wasted work.509 Under the assumption that programmers generally write function calls with relatively low-cost interpretations, a possible work-saving heuristic is to generate only the lowest-cost argument interpretations first, attempt to find a valid top-level interpretation using them, and only if that fails generate the next higher-cost argument interpretations.499 All the algorithms discussed to this point generate the complete set of candidate argument interpretations before attempting to match the containing function call expression. 500 However, given that the top-level expression interpretation that is ultimately chosen is the minimal-cost valid interpretation, any consideration of non-minimal-cost interpretations is in some sense wasted work. 501 Under the assumption that that programmers generally write function calls with relatively low-cost interpretations, a possible work-saving heuristic is to generate only the lowest-cost argument interpretations first, attempt to find a valid top-level interpretation using them, and only if that fails generate the next higher-cost argument interpretations. 510 502 511 503 \subsubsection{Eager} … … 571 563 This comparison closes Baker's open research question, as well as potentially improving Bilson's \CFA compiler. 572 564 573 Rather than testing all of these algorithms in-place in the \CFA compiler, a resolver prototype is being developed thatacts on a simplified input language encapsulating the essential details of the \CFA type-system\footnote{Note this simplified input language is not a usable programming language.}.565 Rather than testing all of these algorithms in-place in the \CFA compiler, a resolver prototype is being developed which acts on a simplified input language encapsulating the essential details of the \CFA type-system\footnote{Note this simplified input language is not a usable programming language.}. 574 566 Multiple variants of this resolver prototype will be implemented, each encapsulating a different expression resolution variant, sharing as much code as feasible. 575 567 These variants will be instrumented to test runtime performance, and run on a variety of input files; the input files may be generated programmatically or from exisiting code in \CFA or similar languages. … … 579 571 As an example, there are currently multiple open proposals for how implicit conversions should interact with polymorphic type binding in \CFA, each with distinct levels of expressive power; if the resolver prototype is modified to support each proposal, the optimal algorithm for each proposal can be compared, providing an empirical demonstration of the trade-off between expressive power and compiler runtime. 580 572 581 This proposed project should provide valuable data on how to implement a performant compiler for programming languages such as \CFA with powerful static type-systems, specifically targeting the feature interaction between name overloading and implicit conversions.573 This proposed project should provide valuable data on how to implement a performant compiler for modern programming languages such as \CFA with powerful static type-systems, specifically targeting the feature interaction between name overloading and implicit conversions. 582 574 This work is not limited in applicability to \CFA, but may also be useful for supporting efficient compilation of the upcoming Concepts standard~\cite{C++concepts} for \CC template constraints, for instance. 583 575 -
src/Common/Assert.cc
re85a8631 r04cdd9b 10 10 // Created On : Thu Aug 18 13:26:59 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 19 17:07:08201613 // Update Count : 1012 // Last Modified On : Thu Aug 18 23:40:29 2016 13 // Update Count : 8 14 14 // 15 15 16 16 #include <assert.h> 17 #include <cstdarg> // varargs18 #include <cstdio> // fprintf19 #include <cstdlib> // abort17 #include <cstdarg> 18 #include <cstdio> 19 #include <cstdlib> 20 20 21 21 extern const char * __progname; // global name of running executable (argv[0]) … … 26 26 void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) { 27 27 fprintf( stderr, CFA_ASSERT_FMT ".\n", __progname, function, line, file ); 28 abort();28 exit( EXIT_FAILURE ); 29 29 } 30 30 … … 35 35 va_start( args, fmt ); 36 36 vfprintf( stderr, fmt, args ); 37 abort();37 exit( EXIT_FAILURE ); 38 38 } 39 39 -
src/Common/utility.h
re85a8631 r04cdd9b 56 56 } 57 57 58 58 59 template< typename Input_iterator > 59 60 void printEnums( Input_iterator begin, Input_iterator end, const char * const *name_array, std::ostream &os ) { -
src/Makefile.am
re85a8631 r04cdd9b 11 11 ## Created On : Sun May 31 08:51:46 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sat Aug 20 11:13:12201614 ## Update Count : 7 113 ## Last Modified On : Thu Aug 18 17:47:06 2016 14 ## Update Count : 70 15 15 ############################################################################### 16 16 … … 43 43 driver_cfa_cpp_SOURCES = ${SRC} 44 44 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap 45 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL - rdynamic -I${abs_top_srcdir}/src/include45 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include 46 46 47 47 MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}} -
src/Makefile.in
re85a8631 r04cdd9b 427 427 driver_cfa_cpp_SOURCES = ${SRC} 428 428 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap 429 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL - rdynamic -I${abs_top_srcdir}/src/include429 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I${abs_top_srcdir}/src/include 430 430 all: $(BUILT_SOURCES) 431 431 $(MAKE) $(AM_MAKEFLAGS) all-am -
src/Parser/DeclarationNode.cc
re85a8631 r04cdd9b 230 230 DeclarationNode *newnode = new DeclarationNode; 231 231 newnode->name = assign_strptr( name ); 232 newnode->enumeratorValue .reset( constant );232 newnode->enumeratorValue = constant; 233 233 typedefTable.addToEnclosingScope( newnode->name, TypedefTable::ID ); 234 234 return newnode; … … 776 776 } // if 777 777 } // if 778 delete o;779 778 return o; 780 779 } -
src/Parser/ExpressionNode.cc
re85a8631 r04cdd9b 183 183 184 184 Expression *build_cast( DeclarationNode *decl_node, ExpressionNode *expr_node ) { 185 Type *targetType = maybeMoveBuildType( decl_node);185 Type *targetType = decl_node->buildType(); 186 186 if ( dynamic_cast< VoidType * >( targetType ) ) { 187 187 delete targetType; … … 213 213 } 214 214 Expression *build_sizeOftype( DeclarationNode *decl_node ) { 215 return new SizeofExpr( maybeMoveBuildType( decl_node ) ); 215 Expression* ret = new SizeofExpr( decl_node->buildType() ); 216 delete decl_node; 217 return ret; 216 218 } 217 219 Expression *build_alignOfexpr( ExpressionNode *expr_node ) { … … 219 221 } 220 222 Expression *build_alignOftype( DeclarationNode *decl_node ) { 221 return new AlignofExpr( maybeMoveBuildType( decl_node) );223 return new AlignofExpr( decl_node->buildType() ); 222 224 } 223 225 Expression *build_offsetOf( DeclarationNode *decl_node, NameExpr *member ) { 224 Expression* ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() ); 226 Expression* ret = new UntypedOffsetofExpr( decl_node->buildType(), member->get_name() ); 227 delete decl_node; 225 228 delete member; 226 229 return ret; … … 266 269 } 267 270 Expression *build_attrtype( NameExpr *var, DeclarationNode * decl_node ) { 268 return new AttrExpr( var, maybeMoveBuildType( decl_node) );271 return new AttrExpr( var, decl_node->buildType() ); 269 272 } 270 273 … … 293 296 } 294 297 Expression *build_typevalue( DeclarationNode *decl ) { 295 return new TypeExpr( maybeMoveBuildType( decl) );298 return new TypeExpr( decl->buildType() ); 296 299 } 297 300 -
src/Parser/InitializerNode.cc
re85a8631 r04cdd9b 45 45 InitializerNode::~InitializerNode() { 46 46 delete expr; 47 delete designator;48 delete kids;49 47 } 50 48 -
src/Parser/ParseNode.h
re85a8631 r04cdd9b 280 280 LinkageSpec::Spec get_linkage() const { return linkage; } 281 281 DeclarationNode *extractAggregate() const; 282 bool has_enumeratorValue() const { return (bool)enumeratorValue; } 283 ExpressionNode *consume_enumeratorValue() const { return const_cast<DeclarationNode*>(this)->enumeratorValue.release(); } 282 ExpressionNode *get_enumeratorValue() const { return enumeratorValue; } 284 283 285 284 bool get_extension() const { return extension; } … … 296 295 std::list< std::string > attributes; 297 296 ExpressionNode *bitfieldWidth; 298 std::unique_ptr<ExpressionNode>enumeratorValue;297 ExpressionNode *enumeratorValue; 299 298 InitializerNode *initializer; 300 299 bool hasEllipsis; … … 307 306 308 307 Type *buildType( TypeData *type ); 309 310 static inline Type * maybeMoveBuildType( const DeclarationNode *orig ) {311 Type* ret = orig ? orig->buildType() : nullptr;312 delete orig;313 return ret;314 }315 308 316 309 //############################################################################## -
src/Parser/StatementNode.cc
re85a8631 r04cdd9b 54 54 // find end of list and maintain previous pointer 55 55 for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) { 56 StatementNode *node = safe_dynamic_cast< StatementNode * >(curr); 56 StatementNode *node = dynamic_cast< StatementNode * >(curr); 57 assert( node ); 57 58 assert( dynamic_cast< CaseStmt * >(node->stmt.get()) ); 58 59 prev = curr; … … 159 160 std::list< Statement * > branches; 160 161 buildMoveList< Statement, StatementNode >( catch_stmt, branches ); 161 CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 162 CompoundStmt *tryBlock = dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 163 assert( tryBlock ); 162 164 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); 163 165 return new TryStmt( noLabels, tryBlock, branches, finallyBlock ); -
src/Parser/TypeData.cc
re85a8631 r04cdd9b 909 909 std::list< Declaration * >::iterator members = ret->get_members().begin(); 910 910 for ( const DeclarationNode *cur = enumeration->constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) { 911 if ( cur-> has_enumeratorValue()) {911 if ( cur->get_enumeratorValue() != nullptr ) { 912 912 ObjectDecl *member = dynamic_cast< ObjectDecl * >(*members); 913 member->set_init( new SingleInit( maybe MoveBuild< Expression >( cur->consume_enumeratorValue() ), std::list< Expression * >() ) );913 member->set_init( new SingleInit( maybeBuild< Expression >( cur->get_enumeratorValue() ), std::list< Expression * >() ) ); 914 914 } // if 915 915 } // for -
src/Parser/parser.cc
re85a8631 r04cdd9b 739 739 1988, 1989, 1990, 1993, 1992, 2003, 2012, 2018, 2024, 2033, 740 740 2039, 2045, 2051, 2057, 2065, 2071, 2079, 2085, 2094, 2095, 741 2096, 2100, 2104, 2106, 211 2, 2113, 2117, 2118, 2123, 2129,742 21 30, 2133, 2135, 2136, 2141, 2142, 2143, 2144, 2178, 2180,743 21 81, 2183, 2188, 2193, 2198, 2200, 2202, 2207, 2209, 2211,744 221 3, 2218, 2220, 2229, 2231, 2232, 2237, 2239, 2241, 2246,745 224 8, 2250, 2255, 2257, 2259, 2268, 2269, 2270, 2274, 2276,746 227 8, 2283, 2285, 2287, 2292, 2294, 2296, 2311, 2313, 2314,747 231 6, 2321, 2322, 2327, 2329, 2331, 2336, 2338, 2340, 2342,748 234 7, 2349, 2351, 2361, 2363, 2364, 2366, 2371, 2373, 2375,749 23 80, 2382, 2384, 2386, 2391, 2393, 2395, 2426, 2428, 2429,750 24 31, 2436, 2441, 2449, 2451, 2453, 2458, 2460, 2465, 2467,751 24 81, 2482, 2484, 2489, 2491, 2493, 2495, 2497, 2502, 2503,752 250 5, 2507, 2512, 2514, 2516, 2522, 2524, 2526, 2530, 2532,753 253 4, 2536, 2550, 2551, 2553, 2558, 2560, 2562, 2564, 2566,754 25 71, 2572, 2574, 2576, 2581, 2583, 2585, 2591, 2592, 2594,755 260 3, 2606, 2608, 2611, 2613, 2615, 2628, 2629, 2631, 2636,756 263 8, 2640, 2642, 2644, 2649, 2650, 2652, 2654, 2659, 2661,757 266 9, 2670, 2671, 2676, 2677, 2681, 2683, 2685, 2687, 2689,758 26 91, 2698, 2700, 2702, 2704, 2706, 2708, 2710, 2712, 2714,759 271 6, 2721, 2723, 2725, 2730, 2756, 2757, 2759, 2763, 2764,760 276 8, 2770, 2772, 2774, 2776, 2778, 2785, 2787, 2789, 2791,761 279 3, 2795, 2800, 2805, 2807, 2809, 2827, 2829, 2834, 2835741 2096, 2100, 2104, 2106, 2111, 2112, 2116, 2117, 2122, 2128, 742 2129, 2132, 2134, 2135, 2139, 2140, 2141, 2142, 2176, 2178, 743 2179, 2181, 2186, 2191, 2196, 2198, 2200, 2205, 2207, 2209, 744 2211, 2216, 2218, 2227, 2229, 2230, 2235, 2237, 2239, 2244, 745 2246, 2248, 2253, 2255, 2257, 2266, 2267, 2268, 2272, 2274, 746 2276, 2281, 2283, 2285, 2290, 2292, 2294, 2309, 2311, 2312, 747 2314, 2319, 2320, 2325, 2327, 2329, 2334, 2336, 2338, 2340, 748 2345, 2347, 2349, 2359, 2361, 2362, 2364, 2369, 2371, 2373, 749 2378, 2380, 2382, 2384, 2389, 2391, 2393, 2424, 2426, 2427, 750 2429, 2434, 2439, 2447, 2449, 2451, 2456, 2458, 2463, 2465, 751 2479, 2480, 2482, 2487, 2489, 2491, 2493, 2495, 2500, 2501, 752 2503, 2505, 2510, 2512, 2514, 2520, 2522, 2524, 2528, 2530, 753 2532, 2534, 2548, 2549, 2551, 2556, 2558, 2560, 2562, 2564, 754 2569, 2570, 2572, 2574, 2579, 2581, 2583, 2589, 2590, 2592, 755 2601, 2604, 2606, 2609, 2611, 2613, 2626, 2627, 2629, 2634, 756 2636, 2638, 2640, 2642, 2647, 2648, 2650, 2652, 2657, 2659, 757 2667, 2668, 2669, 2674, 2675, 2679, 2681, 2683, 2685, 2687, 758 2689, 2696, 2698, 2700, 2702, 2704, 2706, 2708, 2710, 2712, 759 2714, 2719, 2721, 2723, 2728, 2754, 2755, 2757, 2761, 2762, 760 2766, 2768, 2770, 2772, 2774, 2776, 2783, 2785, 2787, 2789, 761 2791, 2793, 2798, 2803, 2805, 2807, 2825, 2827, 2832, 2833 762 762 }; 763 763 #endif … … 7075 7075 break; 7076 7076 7077 case 54 3:7078 #line 21 07"parser.yy" /* yacc.c:1646 */7079 { delete (yyvsp[-2].constant); }7077 case 544: 7078 #line 2111 "parser.yy" /* yacc.c:1646 */ 7079 { (yyval.decl) = 0; } 7080 7080 #line 7081 "Parser/parser.cc" /* yacc.c:1646 */ 7081 7081 break; 7082 7082 7083 case 544: 7084 #line 2112 "parser.yy" /* yacc.c:1646 */ 7083 case 547: 7084 #line 2118 "parser.yy" /* yacc.c:1646 */ 7085 { (yyval.decl) = (yyvsp[0].decl)->addQualifiers( (yyvsp[-1].decl) ); } 7086 #line 7087 "Parser/parser.cc" /* yacc.c:1646 */ 7087 break; 7088 7089 case 548: 7090 #line 2124 "parser.yy" /* yacc.c:1646 */ 7085 7091 { (yyval.decl) = 0; } 7086 #line 7087 "Parser/parser.cc" /* yacc.c:1646 */7087 break;7088 7089 case 547:7090 #line 2119 "parser.yy" /* yacc.c:1646 */7091 { (yyval.decl) = (yyvsp[0].decl)->addQualifiers( (yyvsp[-1].decl) ); }7092 7092 #line 7093 "Parser/parser.cc" /* yacc.c:1646 */ 7093 7093 break; 7094 7094 7095 case 5 48:7096 #line 21 25"parser.yy" /* yacc.c:1646 */7097 { (yyval.decl) = 0;}7095 case 554: 7096 #line 2139 "parser.yy" /* yacc.c:1646 */ 7097 {} 7098 7098 #line 7099 "Parser/parser.cc" /* yacc.c:1646 */ 7099 7099 break; 7100 7100 7101 case 55 3:7102 #line 21 37"parser.yy" /* yacc.c:1646 */7103 { delete (yyvsp[-1].en);}7101 case 555: 7102 #line 2140 "parser.yy" /* yacc.c:1646 */ 7103 {} 7104 7104 #line 7105 "Parser/parser.cc" /* yacc.c:1646 */ 7105 7105 break; 7106 7106 7107 case 55 4:7107 case 556: 7108 7108 #line 2141 "parser.yy" /* yacc.c:1646 */ 7109 { delete (yyvsp[0].tok);}7109 {} 7110 7110 #line 7111 "Parser/parser.cc" /* yacc.c:1646 */ 7111 7111 break; 7112 7112 7113 case 55 5:7113 case 557: 7114 7114 #line 2142 "parser.yy" /* yacc.c:1646 */ 7115 { delete (yyvsp[0].decl);}7115 {} 7116 7116 #line 7117 "Parser/parser.cc" /* yacc.c:1646 */ 7117 7117 break; 7118 7118 7119 case 55 6:7120 #line 21 43"parser.yy" /* yacc.c:1646 */7121 { delete (yyvsp[0].decl); }7119 case 558: 7120 #line 2177 "parser.yy" /* yacc.c:1646 */ 7121 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7122 7122 #line 7123 "Parser/parser.cc" /* yacc.c:1646 */ 7123 7123 break; 7124 7124 7125 case 5 57:7126 #line 21 44"parser.yy" /* yacc.c:1646 */7127 { delete (yyvsp[0].decl); }7125 case 560: 7126 #line 2180 "parser.yy" /* yacc.c:1646 */ 7127 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7128 7128 #line 7129 "Parser/parser.cc" /* yacc.c:1646 */ 7129 7129 break; 7130 7130 7131 case 5 58:7132 #line 21 79"parser.yy" /* yacc.c:1646 */7131 case 561: 7132 #line 2182 "parser.yy" /* yacc.c:1646 */ 7133 7133 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7134 7134 #line 7135 "Parser/parser.cc" /* yacc.c:1646 */ 7135 7135 break; 7136 7136 7137 case 560:7138 #line 2182 "parser.yy" /* yacc.c:1646 */7139 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7140 #line 7141 "Parser/parser.cc" /* yacc.c:1646 */7141 break;7142 7143 case 561:7144 #line 2184 "parser.yy" /* yacc.c:1646 */7145 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7146 #line 7147 "Parser/parser.cc" /* yacc.c:1646 */7147 break;7148 7149 7137 case 562: 7150 #line 218 9"parser.yy" /* yacc.c:1646 */7138 #line 2187 "parser.yy" /* yacc.c:1646 */ 7151 7139 { 7152 7140 typedefTable.setNextIdentifier( *(yyvsp[0].tok) ); 7153 7141 (yyval.decl) = DeclarationNode::newName( (yyvsp[0].tok) ); 7154 7142 } 7143 #line 7144 "Parser/parser.cc" /* yacc.c:1646 */ 7144 break; 7145 7146 case 563: 7147 #line 2192 "parser.yy" /* yacc.c:1646 */ 7148 { (yyval.decl) = (yyvsp[-1].decl); } 7149 #line 7150 "Parser/parser.cc" /* yacc.c:1646 */ 7150 break; 7151 7152 case 564: 7153 #line 2197 "parser.yy" /* yacc.c:1646 */ 7154 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7155 7155 #line 7156 "Parser/parser.cc" /* yacc.c:1646 */ 7156 7156 break; 7157 7157 7158 case 563: 7159 #line 2194 "parser.yy" /* yacc.c:1646 */ 7158 case 565: 7159 #line 2199 "parser.yy" /* yacc.c:1646 */ 7160 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7161 #line 7162 "Parser/parser.cc" /* yacc.c:1646 */ 7162 break; 7163 7164 case 566: 7165 #line 2201 "parser.yy" /* yacc.c:1646 */ 7160 7166 { (yyval.decl) = (yyvsp[-1].decl); } 7161 #line 7162 "Parser/parser.cc" /* yacc.c:1646 */7162 break;7163 7164 case 564:7165 #line 2199 "parser.yy" /* yacc.c:1646 */7166 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }7167 7167 #line 7168 "Parser/parser.cc" /* yacc.c:1646 */ 7168 7168 break; 7169 7169 7170 case 56 5:7171 #line 220 1"parser.yy" /* yacc.c:1646 */7172 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7170 case 567: 7171 #line 2206 "parser.yy" /* yacc.c:1646 */ 7172 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7173 7173 #line 7174 "Parser/parser.cc" /* yacc.c:1646 */ 7174 7174 break; 7175 7175 7176 case 56 6:7177 #line 220 3"parser.yy" /* yacc.c:1646 */7178 { (yyval.decl) = (yyvsp[- 1].decl); }7176 case 568: 7177 #line 2208 "parser.yy" /* yacc.c:1646 */ 7178 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7179 7179 #line 7180 "Parser/parser.cc" /* yacc.c:1646 */ 7180 7180 break; 7181 7181 7182 case 567: 7183 #line 2208 "parser.yy" /* yacc.c:1646 */ 7184 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7185 #line 7186 "Parser/parser.cc" /* yacc.c:1646 */ 7186 break; 7187 7188 case 568: 7182 case 569: 7189 7183 #line 2210 "parser.yy" /* yacc.c:1646 */ 7190 7184 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7185 #line 7186 "Parser/parser.cc" /* yacc.c:1646 */ 7186 break; 7187 7188 case 570: 7189 #line 2212 "parser.yy" /* yacc.c:1646 */ 7190 { (yyval.decl) = (yyvsp[-1].decl); } 7191 7191 #line 7192 "Parser/parser.cc" /* yacc.c:1646 */ 7192 7192 break; 7193 7193 7194 case 5 69:7195 #line 221 2"parser.yy" /* yacc.c:1646 */7196 { (yyval.decl) = (yyvsp[- 2].decl)->addArray( (yyvsp[0].decl) ); }7194 case 571: 7195 #line 2217 "parser.yy" /* yacc.c:1646 */ 7196 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7197 7197 #line 7198 "Parser/parser.cc" /* yacc.c:1646 */ 7198 7198 break; 7199 7199 7200 case 57 0:7201 #line 221 4"parser.yy" /* yacc.c:1646 */7200 case 572: 7201 #line 2219 "parser.yy" /* yacc.c:1646 */ 7202 7202 { (yyval.decl) = (yyvsp[-1].decl); } 7203 7203 #line 7204 "Parser/parser.cc" /* yacc.c:1646 */ 7204 7204 break; 7205 7205 7206 case 571: 7207 #line 2219 "parser.yy" /* yacc.c:1646 */ 7206 case 573: 7207 #line 2228 "parser.yy" /* yacc.c:1646 */ 7208 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7209 #line 7210 "Parser/parser.cc" /* yacc.c:1646 */ 7210 break; 7211 7212 case 575: 7213 #line 2231 "parser.yy" /* yacc.c:1646 */ 7214 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7215 #line 7216 "Parser/parser.cc" /* yacc.c:1646 */ 7216 break; 7217 7218 case 576: 7219 #line 2236 "parser.yy" /* yacc.c:1646 */ 7220 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7221 #line 7222 "Parser/parser.cc" /* yacc.c:1646 */ 7222 break; 7223 7224 case 577: 7225 #line 2238 "parser.yy" /* yacc.c:1646 */ 7208 7226 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7209 #line 72 10"Parser/parser.cc" /* yacc.c:1646 */7210 break; 7211 7212 case 57 2:7213 #line 22 21"parser.yy" /* yacc.c:1646 */7227 #line 7228 "Parser/parser.cc" /* yacc.c:1646 */ 7228 break; 7229 7230 case 578: 7231 #line 2240 "parser.yy" /* yacc.c:1646 */ 7214 7232 { (yyval.decl) = (yyvsp[-1].decl); } 7215 #line 7216 "Parser/parser.cc" /* yacc.c:1646 */7216 break;7217 7218 case 573:7219 #line 2230 "parser.yy" /* yacc.c:1646 */7220 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7221 #line 7222 "Parser/parser.cc" /* yacc.c:1646 */7222 break;7223 7224 case 575:7225 #line 2233 "parser.yy" /* yacc.c:1646 */7226 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7227 #line 7228 "Parser/parser.cc" /* yacc.c:1646 */7228 break;7229 7230 case 576:7231 #line 2238 "parser.yy" /* yacc.c:1646 */7232 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); }7233 7233 #line 7234 "Parser/parser.cc" /* yacc.c:1646 */ 7234 7234 break; 7235 7235 7236 case 57 7:7237 #line 224 0"parser.yy" /* yacc.c:1646 */7238 { (yyval.decl) = (yyvsp[ -6].decl)->addParamList( (yyvsp[-2].decl) ); }7236 case 579: 7237 #line 2245 "parser.yy" /* yacc.c:1646 */ 7238 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7239 7239 #line 7240 "Parser/parser.cc" /* yacc.c:1646 */ 7240 7240 break; 7241 7241 7242 case 578: 7243 #line 2242 "parser.yy" /* yacc.c:1646 */ 7242 case 580: 7243 #line 2247 "parser.yy" /* yacc.c:1646 */ 7244 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7245 #line 7246 "Parser/parser.cc" /* yacc.c:1646 */ 7246 break; 7247 7248 case 581: 7249 #line 2249 "parser.yy" /* yacc.c:1646 */ 7244 7250 { (yyval.decl) = (yyvsp[-1].decl); } 7245 #line 7246 "Parser/parser.cc" /* yacc.c:1646 */7246 break;7247 7248 case 579:7249 #line 2247 "parser.yy" /* yacc.c:1646 */7250 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }7251 7251 #line 7252 "Parser/parser.cc" /* yacc.c:1646 */ 7252 7252 break; 7253 7253 7254 case 58 0:7255 #line 22 49"parser.yy" /* yacc.c:1646 */7256 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7254 case 582: 7255 #line 2254 "parser.yy" /* yacc.c:1646 */ 7256 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7257 7257 #line 7258 "Parser/parser.cc" /* yacc.c:1646 */ 7258 7258 break; 7259 7259 7260 case 581: 7261 #line 2251 "parser.yy" /* yacc.c:1646 */ 7262 { (yyval.decl) = (yyvsp[-1].decl); } 7263 #line 7264 "Parser/parser.cc" /* yacc.c:1646 */ 7264 break; 7265 7266 case 582: 7260 case 583: 7267 7261 #line 2256 "parser.yy" /* yacc.c:1646 */ 7268 7262 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7263 #line 7264 "Parser/parser.cc" /* yacc.c:1646 */ 7264 break; 7265 7266 case 584: 7267 #line 2258 "parser.yy" /* yacc.c:1646 */ 7268 { (yyval.decl) = (yyvsp[-1].decl); } 7269 7269 #line 7270 "Parser/parser.cc" /* yacc.c:1646 */ 7270 7270 break; 7271 7271 7272 case 583: 7273 #line 2258 "parser.yy" /* yacc.c:1646 */ 7272 case 588: 7273 #line 2273 "parser.yy" /* yacc.c:1646 */ 7274 { (yyval.decl) = (yyvsp[-3].decl)->addIdList( (yyvsp[-1].decl) ); } 7275 #line 7276 "Parser/parser.cc" /* yacc.c:1646 */ 7276 break; 7277 7278 case 589: 7279 #line 2275 "parser.yy" /* yacc.c:1646 */ 7280 { (yyval.decl) = (yyvsp[-4].decl)->addIdList( (yyvsp[-1].decl) ); } 7281 #line 7282 "Parser/parser.cc" /* yacc.c:1646 */ 7282 break; 7283 7284 case 590: 7285 #line 2277 "parser.yy" /* yacc.c:1646 */ 7286 { (yyval.decl) = (yyvsp[-1].decl); } 7287 #line 7288 "Parser/parser.cc" /* yacc.c:1646 */ 7288 break; 7289 7290 case 591: 7291 #line 2282 "parser.yy" /* yacc.c:1646 */ 7292 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7293 #line 7294 "Parser/parser.cc" /* yacc.c:1646 */ 7294 break; 7295 7296 case 592: 7297 #line 2284 "parser.yy" /* yacc.c:1646 */ 7298 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7299 #line 7300 "Parser/parser.cc" /* yacc.c:1646 */ 7300 break; 7301 7302 case 593: 7303 #line 2286 "parser.yy" /* yacc.c:1646 */ 7304 { (yyval.decl) = (yyvsp[-1].decl); } 7305 #line 7306 "Parser/parser.cc" /* yacc.c:1646 */ 7306 break; 7307 7308 case 594: 7309 #line 2291 "parser.yy" /* yacc.c:1646 */ 7274 7310 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7275 #line 7276 "Parser/parser.cc" /* yacc.c:1646 */7276 break;7277 7278 case 584:7279 #line 2260 "parser.yy" /* yacc.c:1646 */7280 { (yyval.decl) = (yyvsp[-1].decl); }7281 #line 7282 "Parser/parser.cc" /* yacc.c:1646 */7282 break;7283 7284 case 588:7285 #line 2275 "parser.yy" /* yacc.c:1646 */7286 { (yyval.decl) = (yyvsp[-3].decl)->addIdList( (yyvsp[-1].decl) ); }7287 #line 7288 "Parser/parser.cc" /* yacc.c:1646 */7288 break;7289 7290 case 589:7291 #line 2277 "parser.yy" /* yacc.c:1646 */7292 { (yyval.decl) = (yyvsp[-4].decl)->addIdList( (yyvsp[-1].decl) ); }7293 #line 7294 "Parser/parser.cc" /* yacc.c:1646 */7294 break;7295 7296 case 590:7297 #line 2279 "parser.yy" /* yacc.c:1646 */7298 { (yyval.decl) = (yyvsp[-1].decl); }7299 #line 7300 "Parser/parser.cc" /* yacc.c:1646 */7300 break;7301 7302 case 591:7303 #line 2284 "parser.yy" /* yacc.c:1646 */7304 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }7305 #line 7306 "Parser/parser.cc" /* yacc.c:1646 */7306 break;7307 7308 case 592:7309 #line 2286 "parser.yy" /* yacc.c:1646 */7310 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); }7311 7311 #line 7312 "Parser/parser.cc" /* yacc.c:1646 */ 7312 7312 break; 7313 7313 7314 case 593: 7315 #line 2288 "parser.yy" /* yacc.c:1646 */ 7316 { (yyval.decl) = (yyvsp[-1].decl); } 7317 #line 7318 "Parser/parser.cc" /* yacc.c:1646 */ 7318 break; 7319 7320 case 594: 7314 case 595: 7321 7315 #line 2293 "parser.yy" /* yacc.c:1646 */ 7322 7316 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7317 #line 7318 "Parser/parser.cc" /* yacc.c:1646 */ 7318 break; 7319 7320 case 596: 7321 #line 2295 "parser.yy" /* yacc.c:1646 */ 7322 { (yyval.decl) = (yyvsp[-1].decl); } 7323 7323 #line 7324 "Parser/parser.cc" /* yacc.c:1646 */ 7324 7324 break; 7325 7325 7326 case 59 5:7327 #line 2 295"parser.yy" /* yacc.c:1646 */7328 { (yyval.decl) = (yyvsp[- 2].decl)->addArray( (yyvsp[0].decl) ); }7326 case 597: 7327 #line 2310 "parser.yy" /* yacc.c:1646 */ 7328 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7329 7329 #line 7330 "Parser/parser.cc" /* yacc.c:1646 */ 7330 7330 break; 7331 7331 7332 case 59 6:7333 #line 2 297"parser.yy" /* yacc.c:1646 */7334 { (yyval.decl) = (yyvsp[-1].decl) ; }7332 case 599: 7333 #line 2313 "parser.yy" /* yacc.c:1646 */ 7334 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7335 7335 #line 7336 "Parser/parser.cc" /* yacc.c:1646 */ 7336 7336 break; 7337 7337 7338 case 597:7339 #line 231 2"parser.yy" /* yacc.c:1646 */7338 case 600: 7339 #line 2315 "parser.yy" /* yacc.c:1646 */ 7340 7340 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7341 7341 #line 7342 "Parser/parser.cc" /* yacc.c:1646 */ 7342 7342 break; 7343 7343 7344 case 599:7345 #line 23 15"parser.yy" /* yacc.c:1646 */7346 { (yyval.decl) = (yyvsp[-1].decl) ->addQualifiers( (yyvsp[0].decl) ); }7344 case 602: 7345 #line 2321 "parser.yy" /* yacc.c:1646 */ 7346 { (yyval.decl) = (yyvsp[-1].decl); } 7347 7347 #line 7348 "Parser/parser.cc" /* yacc.c:1646 */ 7348 7348 break; 7349 7349 7350 case 60 0:7351 #line 23 17"parser.yy" /* yacc.c:1646 */7352 { (yyval.decl) = (yyvsp[ -1].decl)->addQualifiers( (yyvsp[0].decl) ); }7350 case 603: 7351 #line 2326 "parser.yy" /* yacc.c:1646 */ 7352 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7353 7353 #line 7354 "Parser/parser.cc" /* yacc.c:1646 */ 7354 7354 break; 7355 7355 7356 case 602: 7357 #line 2323 "parser.yy" /* yacc.c:1646 */ 7356 case 604: 7357 #line 2328 "parser.yy" /* yacc.c:1646 */ 7358 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7359 #line 7360 "Parser/parser.cc" /* yacc.c:1646 */ 7360 break; 7361 7362 case 605: 7363 #line 2330 "parser.yy" /* yacc.c:1646 */ 7358 7364 { (yyval.decl) = (yyvsp[-1].decl); } 7359 #line 7360 "Parser/parser.cc" /* yacc.c:1646 */7360 break;7361 7362 case 603:7363 #line 2328 "parser.yy" /* yacc.c:1646 */7364 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }7365 7365 #line 7366 "Parser/parser.cc" /* yacc.c:1646 */ 7366 7366 break; 7367 7367 7368 case 60 4:7369 #line 233 0"parser.yy" /* yacc.c:1646 */7370 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7368 case 606: 7369 #line 2335 "parser.yy" /* yacc.c:1646 */ 7370 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7371 7371 #line 7372 "Parser/parser.cc" /* yacc.c:1646 */ 7372 7372 break; 7373 7373 7374 case 60 5:7375 #line 233 2"parser.yy" /* yacc.c:1646 */7376 { (yyval.decl) = (yyvsp[- 1].decl); }7374 case 607: 7375 #line 2337 "parser.yy" /* yacc.c:1646 */ 7376 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7377 7377 #line 7378 "Parser/parser.cc" /* yacc.c:1646 */ 7378 7378 break; 7379 7379 7380 case 606: 7381 #line 2337 "parser.yy" /* yacc.c:1646 */ 7382 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7383 #line 7384 "Parser/parser.cc" /* yacc.c:1646 */ 7384 break; 7385 7386 case 607: 7380 case 608: 7387 7381 #line 2339 "parser.yy" /* yacc.c:1646 */ 7388 7382 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7383 #line 7384 "Parser/parser.cc" /* yacc.c:1646 */ 7384 break; 7385 7386 case 609: 7387 #line 2341 "parser.yy" /* yacc.c:1646 */ 7388 { (yyval.decl) = (yyvsp[-1].decl); } 7389 7389 #line 7390 "Parser/parser.cc" /* yacc.c:1646 */ 7390 7390 break; 7391 7391 7392 case 6 08:7393 #line 234 1"parser.yy" /* yacc.c:1646 */7394 { (yyval.decl) = (yyvsp[- 2].decl)->addArray( (yyvsp[0].decl) ); }7392 case 610: 7393 #line 2346 "parser.yy" /* yacc.c:1646 */ 7394 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7395 7395 #line 7396 "Parser/parser.cc" /* yacc.c:1646 */ 7396 7396 break; 7397 7397 7398 case 609: 7399 #line 2343 "parser.yy" /* yacc.c:1646 */ 7398 case 611: 7399 #line 2348 "parser.yy" /* yacc.c:1646 */ 7400 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7401 #line 7402 "Parser/parser.cc" /* yacc.c:1646 */ 7402 break; 7403 7404 case 612: 7405 #line 2350 "parser.yy" /* yacc.c:1646 */ 7400 7406 { (yyval.decl) = (yyvsp[-1].decl); } 7401 #line 7402 "Parser/parser.cc" /* yacc.c:1646 */7402 break;7403 7404 case 610:7405 #line 2348 "parser.yy" /* yacc.c:1646 */7406 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); }7407 7407 #line 7408 "Parser/parser.cc" /* yacc.c:1646 */ 7408 7408 break; 7409 7409 7410 case 61 1:7411 #line 23 50 "parser.yy" /* yacc.c:1646 */7412 { (yyval.decl) = (yyvsp[- 6].decl)->addParamList( (yyvsp[-2].decl) ); }7410 case 613: 7411 #line 2360 "parser.yy" /* yacc.c:1646 */ 7412 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7413 7413 #line 7414 "Parser/parser.cc" /* yacc.c:1646 */ 7414 7414 break; 7415 7415 7416 case 61 2:7417 #line 23 52"parser.yy" /* yacc.c:1646 */7418 { (yyval.decl) = (yyvsp[-1].decl) ; }7416 case 615: 7417 #line 2363 "parser.yy" /* yacc.c:1646 */ 7418 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7419 7419 #line 7420 "Parser/parser.cc" /* yacc.c:1646 */ 7420 7420 break; 7421 7421 7422 case 61 3:7423 #line 236 2"parser.yy" /* yacc.c:1646 */7422 case 616: 7423 #line 2365 "parser.yy" /* yacc.c:1646 */ 7424 7424 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7425 7425 #line 7426 "Parser/parser.cc" /* yacc.c:1646 */ 7426 7426 break; 7427 7427 7428 case 61 5:7429 #line 23 65"parser.yy" /* yacc.c:1646 */7430 { (yyval.decl) = (yyvsp[ -1].decl)->addQualifiers( (yyvsp[0].decl) ); }7428 case 617: 7429 #line 2370 "parser.yy" /* yacc.c:1646 */ 7430 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7431 7431 #line 7432 "Parser/parser.cc" /* yacc.c:1646 */ 7432 7432 break; 7433 7433 7434 case 61 6:7435 #line 23 67"parser.yy" /* yacc.c:1646 */7436 { (yyval.decl) = (yyvsp[ -1].decl)->addQualifiers( (yyvsp[0].decl) ); }7434 case 618: 7435 #line 2372 "parser.yy" /* yacc.c:1646 */ 7436 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7437 7437 #line 7438 "Parser/parser.cc" /* yacc.c:1646 */ 7438 7438 break; 7439 7439 7440 case 61 7:7441 #line 237 2"parser.yy" /* yacc.c:1646 */7442 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( 0 )); }7440 case 619: 7441 #line 2374 "parser.yy" /* yacc.c:1646 */ 7442 { (yyval.decl) = (yyvsp[-1].decl); } 7443 7443 #line 7444 "Parser/parser.cc" /* yacc.c:1646 */ 7444 7444 break; 7445 7445 7446 case 6 18:7447 #line 237 4"parser.yy" /* yacc.c:1646 */7448 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7446 case 620: 7447 #line 2379 "parser.yy" /* yacc.c:1646 */ 7448 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7449 7449 #line 7450 "Parser/parser.cc" /* yacc.c:1646 */ 7450 7450 break; 7451 7451 7452 case 6 19:7453 #line 23 76"parser.yy" /* yacc.c:1646 */7454 { (yyval.decl) = (yyvsp[- 1].decl); }7452 case 621: 7453 #line 2381 "parser.yy" /* yacc.c:1646 */ 7454 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7455 7455 #line 7456 "Parser/parser.cc" /* yacc.c:1646 */ 7456 7456 break; 7457 7457 7458 case 620: 7459 #line 2381 "parser.yy" /* yacc.c:1646 */ 7460 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7461 #line 7462 "Parser/parser.cc" /* yacc.c:1646 */ 7462 break; 7463 7464 case 621: 7458 case 622: 7465 7459 #line 2383 "parser.yy" /* yacc.c:1646 */ 7466 7460 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7461 #line 7462 "Parser/parser.cc" /* yacc.c:1646 */ 7462 break; 7463 7464 case 623: 7465 #line 2385 "parser.yy" /* yacc.c:1646 */ 7466 { (yyval.decl) = (yyvsp[-1].decl); } 7467 7467 #line 7468 "Parser/parser.cc" /* yacc.c:1646 */ 7468 7468 break; 7469 7469 7470 case 62 2:7471 #line 23 85"parser.yy" /* yacc.c:1646 */7472 { (yyval.decl) = (yyvsp[- 2].decl)->addArray( (yyvsp[0].decl) ); }7470 case 624: 7471 #line 2390 "parser.yy" /* yacc.c:1646 */ 7472 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7473 7473 #line 7474 "Parser/parser.cc" /* yacc.c:1646 */ 7474 7474 break; 7475 7475 7476 case 623: 7477 #line 2387 "parser.yy" /* yacc.c:1646 */ 7476 case 625: 7477 #line 2392 "parser.yy" /* yacc.c:1646 */ 7478 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7479 #line 7480 "Parser/parser.cc" /* yacc.c:1646 */ 7480 break; 7481 7482 case 626: 7483 #line 2394 "parser.yy" /* yacc.c:1646 */ 7478 7484 { (yyval.decl) = (yyvsp[-1].decl); } 7479 #line 7480 "Parser/parser.cc" /* yacc.c:1646 */7480 break;7481 7482 case 624:7483 #line 2392 "parser.yy" /* yacc.c:1646 */7484 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); }7485 7485 #line 7486 "Parser/parser.cc" /* yacc.c:1646 */ 7486 7486 break; 7487 7487 7488 case 62 5:7489 #line 2 394"parser.yy" /* yacc.c:1646 */7490 { (yyval.decl) = (yyvsp[- 6].decl)->addParamList( (yyvsp[-2].decl) ); }7488 case 627: 7489 #line 2425 "parser.yy" /* yacc.c:1646 */ 7490 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7491 7491 #line 7492 "Parser/parser.cc" /* yacc.c:1646 */ 7492 7492 break; 7493 7493 7494 case 62 6:7495 #line 2 396"parser.yy" /* yacc.c:1646 */7496 { (yyval.decl) = (yyvsp[-1].decl) ; }7494 case 629: 7495 #line 2428 "parser.yy" /* yacc.c:1646 */ 7496 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7497 7497 #line 7498 "Parser/parser.cc" /* yacc.c:1646 */ 7498 7498 break; 7499 7499 7500 case 6 27:7501 #line 24 27"parser.yy" /* yacc.c:1646 */7500 case 630: 7501 #line 2430 "parser.yy" /* yacc.c:1646 */ 7502 7502 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7503 7503 #line 7504 "Parser/parser.cc" /* yacc.c:1646 */ 7504 7504 break; 7505 7505 7506 case 629:7507 #line 2430 "parser.yy" /* yacc.c:1646 */7508 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7509 #line 7510 "Parser/parser.cc" /* yacc.c:1646 */7510 break;7511 7512 case 630:7513 #line 2432 "parser.yy" /* yacc.c:1646 */7514 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7515 #line 7516 "Parser/parser.cc" /* yacc.c:1646 */7516 break;7517 7518 7506 case 631: 7519 #line 243 7"parser.yy" /* yacc.c:1646 */7507 #line 2435 "parser.yy" /* yacc.c:1646 */ 7520 7508 { 7521 7509 typedefTable.setNextIdentifier( *(yyvsp[0].tok) ); 7522 7510 (yyval.decl) = DeclarationNode::newName( (yyvsp[0].tok) ); 7523 7511 } 7524 #line 75 25"Parser/parser.cc" /* yacc.c:1646 */7512 #line 7513 "Parser/parser.cc" /* yacc.c:1646 */ 7525 7513 break; 7526 7514 7527 7515 case 632: 7528 #line 244 2"parser.yy" /* yacc.c:1646 */7516 #line 2440 "parser.yy" /* yacc.c:1646 */ 7529 7517 { 7530 7518 typedefTable.setNextIdentifier( *(yyvsp[0].tok) ); 7531 7519 (yyval.decl) = DeclarationNode::newName( (yyvsp[0].tok) ); 7532 7520 } 7521 #line 7522 "Parser/parser.cc" /* yacc.c:1646 */ 7522 break; 7523 7524 case 633: 7525 #line 2448 "parser.yy" /* yacc.c:1646 */ 7526 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7527 #line 7528 "Parser/parser.cc" /* yacc.c:1646 */ 7528 break; 7529 7530 case 634: 7531 #line 2450 "parser.yy" /* yacc.c:1646 */ 7532 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7533 7533 #line 7534 "Parser/parser.cc" /* yacc.c:1646 */ 7534 7534 break; 7535 7535 7536 case 63 3:7537 #line 245 0"parser.yy" /* yacc.c:1646 */7538 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( 0 )); }7536 case 635: 7537 #line 2452 "parser.yy" /* yacc.c:1646 */ 7538 { (yyval.decl) = (yyvsp[-1].decl); } 7539 7539 #line 7540 "Parser/parser.cc" /* yacc.c:1646 */ 7540 7540 break; 7541 7541 7542 case 63 4:7543 #line 245 2"parser.yy" /* yacc.c:1646 */7544 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7542 case 636: 7543 #line 2457 "parser.yy" /* yacc.c:1646 */ 7544 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7545 7545 #line 7546 "Parser/parser.cc" /* yacc.c:1646 */ 7546 7546 break; 7547 7547 7548 case 63 5:7549 #line 245 4"parser.yy" /* yacc.c:1646 */7550 { (yyval.decl) = (yyvsp[- 1].decl); }7548 case 637: 7549 #line 2459 "parser.yy" /* yacc.c:1646 */ 7550 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7551 7551 #line 7552 "Parser/parser.cc" /* yacc.c:1646 */ 7552 7552 break; 7553 7553 7554 case 63 6:7555 #line 24 59"parser.yy" /* yacc.c:1646 */7556 { (yyval.decl) = (yyvsp[- 1].decl)->addArray( (yyvsp[0].decl) ); }7554 case 638: 7555 #line 2464 "parser.yy" /* yacc.c:1646 */ 7556 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7557 7557 #line 7558 "Parser/parser.cc" /* yacc.c:1646 */ 7558 7558 break; 7559 7559 7560 case 63 7:7561 #line 246 1"parser.yy" /* yacc.c:1646 */7562 { (yyval.decl) = (yyvsp[- 2].decl)->addArray( (yyvsp[0].decl) ); }7560 case 639: 7561 #line 2466 "parser.yy" /* yacc.c:1646 */ 7562 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7563 7563 #line 7564 "Parser/parser.cc" /* yacc.c:1646 */ 7564 7564 break; 7565 7565 7566 case 6 38:7567 #line 24 66"parser.yy" /* yacc.c:1646 */7568 { (yyval.decl) = (yyvsp[- 5].decl)->addParamList( (yyvsp[-2].decl) ); }7566 case 641: 7567 #line 2481 "parser.yy" /* yacc.c:1646 */ 7568 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7569 7569 #line 7570 "Parser/parser.cc" /* yacc.c:1646 */ 7570 7570 break; 7571 7571 7572 case 639: 7573 #line 2468 "parser.yy" /* yacc.c:1646 */ 7574 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7575 #line 7576 "Parser/parser.cc" /* yacc.c:1646 */ 7576 break; 7577 7578 case 641: 7572 case 642: 7579 7573 #line 2483 "parser.yy" /* yacc.c:1646 */ 7580 7574 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7575 #line 7576 "Parser/parser.cc" /* yacc.c:1646 */ 7576 break; 7577 7578 case 643: 7579 #line 2488 "parser.yy" /* yacc.c:1646 */ 7580 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 7581 7581 #line 7582 "Parser/parser.cc" /* yacc.c:1646 */ 7582 7582 break; 7583 7583 7584 case 64 2:7585 #line 24 85"parser.yy" /* yacc.c:1646 */7586 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7584 case 644: 7585 #line 2490 "parser.yy" /* yacc.c:1646 */ 7586 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); } 7587 7587 #line 7588 "Parser/parser.cc" /* yacc.c:1646 */ 7588 7588 break; 7589 7589 7590 case 64 3:7591 #line 249 0"parser.yy" /* yacc.c:1646 */7592 { (yyval.decl) = DeclarationNode::newPointer( 0); }7590 case 645: 7591 #line 2492 "parser.yy" /* yacc.c:1646 */ 7592 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7593 7593 #line 7594 "Parser/parser.cc" /* yacc.c:1646 */ 7594 7594 break; 7595 7595 7596 case 64 4:7597 #line 249 2"parser.yy" /* yacc.c:1646 */7598 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); }7596 case 646: 7597 #line 2494 "parser.yy" /* yacc.c:1646 */ 7598 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7599 7599 #line 7600 "Parser/parser.cc" /* yacc.c:1646 */ 7600 7600 break; 7601 7601 7602 case 64 5:7603 #line 249 4"parser.yy" /* yacc.c:1646 */7604 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( 0 )); }7602 case 647: 7603 #line 2496 "parser.yy" /* yacc.c:1646 */ 7604 { (yyval.decl) = (yyvsp[-1].decl); } 7605 7605 #line 7606 "Parser/parser.cc" /* yacc.c:1646 */ 7606 7606 break; 7607 7607 7608 case 64 6:7609 #line 2 496"parser.yy" /* yacc.c:1646 */7610 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7608 case 649: 7609 #line 2502 "parser.yy" /* yacc.c:1646 */ 7610 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7611 7611 #line 7612 "Parser/parser.cc" /* yacc.c:1646 */ 7612 7612 break; 7613 7613 7614 case 647: 7615 #line 2498 "parser.yy" /* yacc.c:1646 */ 7616 { (yyval.decl) = (yyvsp[-1].decl); } 7617 #line 7618 "Parser/parser.cc" /* yacc.c:1646 */ 7618 break; 7619 7620 case 649: 7614 case 650: 7621 7615 #line 2504 "parser.yy" /* yacc.c:1646 */ 7622 7616 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7617 #line 7618 "Parser/parser.cc" /* yacc.c:1646 */ 7618 break; 7619 7620 case 651: 7621 #line 2506 "parser.yy" /* yacc.c:1646 */ 7622 { (yyval.decl) = (yyvsp[-1].decl); } 7623 7623 #line 7624 "Parser/parser.cc" /* yacc.c:1646 */ 7624 7624 break; 7625 7625 7626 case 65 0:7627 #line 25 06"parser.yy" /* yacc.c:1646 */7628 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl)); }7626 case 652: 7627 #line 2511 "parser.yy" /* yacc.c:1646 */ 7628 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[-2].decl), 0 ); } 7629 7629 #line 7630 "Parser/parser.cc" /* yacc.c:1646 */ 7630 7630 break; 7631 7631 7632 case 651: 7633 #line 2508 "parser.yy" /* yacc.c:1646 */ 7632 case 653: 7633 #line 2513 "parser.yy" /* yacc.c:1646 */ 7634 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7635 #line 7636 "Parser/parser.cc" /* yacc.c:1646 */ 7636 break; 7637 7638 case 654: 7639 #line 2515 "parser.yy" /* yacc.c:1646 */ 7634 7640 { (yyval.decl) = (yyvsp[-1].decl); } 7635 #line 7636 "Parser/parser.cc" /* yacc.c:1646 */7636 break;7637 7638 case 652:7639 #line 2513 "parser.yy" /* yacc.c:1646 */7640 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[-2].decl), 0 ); }7641 7641 #line 7642 "Parser/parser.cc" /* yacc.c:1646 */ 7642 7642 break; 7643 7643 7644 case 65 3:7645 #line 25 15"parser.yy" /* yacc.c:1646 */7646 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl)); }7644 case 655: 7645 #line 2521 "parser.yy" /* yacc.c:1646 */ 7646 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 7647 7647 #line 7648 "Parser/parser.cc" /* yacc.c:1646 */ 7648 7648 break; 7649 7649 7650 case 65 4:7651 #line 25 17"parser.yy" /* yacc.c:1646 */7652 { (yyval.decl) = (yyvsp[-1].decl); }7650 case 656: 7651 #line 2523 "parser.yy" /* yacc.c:1646 */ 7652 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[0].decl) ); } 7653 7653 #line 7654 "Parser/parser.cc" /* yacc.c:1646 */ 7654 7654 break; 7655 7655 7656 case 65 5:7657 #line 252 3"parser.yy" /* yacc.c:1646 */7658 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }7656 case 658: 7657 #line 2529 "parser.yy" /* yacc.c:1646 */ 7658 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), 0, false ); } 7659 7659 #line 7660 "Parser/parser.cc" /* yacc.c:1646 */ 7660 7660 break; 7661 7661 7662 case 65 6:7663 #line 25 25"parser.yy" /* yacc.c:1646 */7664 { (yyval.decl) = DeclarationNode::new Array( 0, 0, false )->addArray( (yyvsp[0].decl)); }7662 case 659: 7663 #line 2531 "parser.yy" /* yacc.c:1646 */ 7664 { (yyval.decl) = DeclarationNode::newVarArray( 0 ); } 7665 7665 #line 7666 "Parser/parser.cc" /* yacc.c:1646 */ 7666 7666 break; 7667 7667 7668 case 6 58:7669 #line 253 1"parser.yy" /* yacc.c:1646 */7670 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), 0, false); }7668 case 660: 7669 #line 2533 "parser.yy" /* yacc.c:1646 */ 7670 { (yyval.decl) = (yyvsp[-5].decl)->addArray( DeclarationNode::newArray( (yyvsp[-2].en), 0, false ) ); } 7671 7671 #line 7672 "Parser/parser.cc" /* yacc.c:1646 */ 7672 7672 break; 7673 7673 7674 case 6 59:7675 #line 253 3"parser.yy" /* yacc.c:1646 */7676 { (yyval.decl) = DeclarationNode::newVarArray( 0); }7674 case 661: 7675 #line 2535 "parser.yy" /* yacc.c:1646 */ 7676 { (yyval.decl) = (yyvsp[-5].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); } 7677 7677 #line 7678 "Parser/parser.cc" /* yacc.c:1646 */ 7678 7678 break; 7679 7679 7680 case 66 0:7681 #line 25 35"parser.yy" /* yacc.c:1646 */7682 { (yyval.decl) = (yyvsp[- 5].decl)->addArray( DeclarationNode::newArray( (yyvsp[-2].en), 0, false) ); }7680 case 663: 7681 #line 2550 "parser.yy" /* yacc.c:1646 */ 7682 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7683 7683 #line 7684 "Parser/parser.cc" /* yacc.c:1646 */ 7684 7684 break; 7685 7685 7686 case 661: 7687 #line 2537 "parser.yy" /* yacc.c:1646 */ 7688 { (yyval.decl) = (yyvsp[-5].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); } 7689 #line 7690 "Parser/parser.cc" /* yacc.c:1646 */ 7690 break; 7691 7692 case 663: 7686 case 664: 7693 7687 #line 2552 "parser.yy" /* yacc.c:1646 */ 7694 7688 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7689 #line 7690 "Parser/parser.cc" /* yacc.c:1646 */ 7690 break; 7691 7692 case 665: 7693 #line 2557 "parser.yy" /* yacc.c:1646 */ 7694 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 7695 7695 #line 7696 "Parser/parser.cc" /* yacc.c:1646 */ 7696 7696 break; 7697 7697 7698 case 66 4:7699 #line 255 4"parser.yy" /* yacc.c:1646 */7700 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7698 case 666: 7699 #line 2559 "parser.yy" /* yacc.c:1646 */ 7700 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); } 7701 7701 #line 7702 "Parser/parser.cc" /* yacc.c:1646 */ 7702 7702 break; 7703 7703 7704 case 66 5:7705 #line 25 59"parser.yy" /* yacc.c:1646 */7706 { (yyval.decl) = DeclarationNode::newPointer( 0); }7704 case 667: 7705 #line 2561 "parser.yy" /* yacc.c:1646 */ 7706 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7707 7707 #line 7708 "Parser/parser.cc" /* yacc.c:1646 */ 7708 7708 break; 7709 7709 7710 case 66 6:7711 #line 256 1"parser.yy" /* yacc.c:1646 */7712 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); }7710 case 668: 7711 #line 2563 "parser.yy" /* yacc.c:1646 */ 7712 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7713 7713 #line 7714 "Parser/parser.cc" /* yacc.c:1646 */ 7714 7714 break; 7715 7715 7716 case 66 7:7717 #line 256 3"parser.yy" /* yacc.c:1646 */7718 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( 0 )); }7716 case 669: 7717 #line 2565 "parser.yy" /* yacc.c:1646 */ 7718 { (yyval.decl) = (yyvsp[-1].decl); } 7719 7719 #line 7720 "Parser/parser.cc" /* yacc.c:1646 */ 7720 7720 break; 7721 7721 7722 case 6 68:7723 #line 25 65"parser.yy" /* yacc.c:1646 */7724 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7722 case 671: 7723 #line 2571 "parser.yy" /* yacc.c:1646 */ 7724 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7725 7725 #line 7726 "Parser/parser.cc" /* yacc.c:1646 */ 7726 7726 break; 7727 7727 7728 case 669: 7729 #line 2567 "parser.yy" /* yacc.c:1646 */ 7730 { (yyval.decl) = (yyvsp[-1].decl); } 7731 #line 7732 "Parser/parser.cc" /* yacc.c:1646 */ 7732 break; 7733 7734 case 671: 7728 case 672: 7735 7729 #line 2573 "parser.yy" /* yacc.c:1646 */ 7736 7730 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7731 #line 7732 "Parser/parser.cc" /* yacc.c:1646 */ 7732 break; 7733 7734 case 673: 7735 #line 2575 "parser.yy" /* yacc.c:1646 */ 7736 { (yyval.decl) = (yyvsp[-1].decl); } 7737 7737 #line 7738 "Parser/parser.cc" /* yacc.c:1646 */ 7738 7738 break; 7739 7739 7740 case 67 2:7741 #line 25 75"parser.yy" /* yacc.c:1646 */7742 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl)); }7740 case 674: 7741 #line 2580 "parser.yy" /* yacc.c:1646 */ 7742 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[-2].decl), 0 ); } 7743 7743 #line 7744 "Parser/parser.cc" /* yacc.c:1646 */ 7744 7744 break; 7745 7745 7746 case 673: 7747 #line 2577 "parser.yy" /* yacc.c:1646 */ 7746 case 675: 7747 #line 2582 "parser.yy" /* yacc.c:1646 */ 7748 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7749 #line 7750 "Parser/parser.cc" /* yacc.c:1646 */ 7750 break; 7751 7752 case 676: 7753 #line 2584 "parser.yy" /* yacc.c:1646 */ 7748 7754 { (yyval.decl) = (yyvsp[-1].decl); } 7749 #line 7750 "Parser/parser.cc" /* yacc.c:1646 */7750 break;7751 7752 case 674:7753 #line 2582 "parser.yy" /* yacc.c:1646 */7754 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[-2].decl), 0 ); }7755 7755 #line 7756 "Parser/parser.cc" /* yacc.c:1646 */ 7756 7756 break; 7757 7757 7758 case 67 5:7759 #line 25 84"parser.yy" /* yacc.c:1646 */7760 { (yyval.decl) = (yyvsp[- 6].decl)->addParamList( (yyvsp[-2].decl) ); }7758 case 678: 7759 #line 2591 "parser.yy" /* yacc.c:1646 */ 7760 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7761 7761 #line 7762 "Parser/parser.cc" /* yacc.c:1646 */ 7762 7762 break; 7763 7763 7764 case 6 76:7765 #line 2 586"parser.yy" /* yacc.c:1646 */7766 { (yyval.decl) = (yyvsp[-1].decl); }7764 case 680: 7765 #line 2602 "parser.yy" /* yacc.c:1646 */ 7766 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 7767 7767 #line 7768 "Parser/parser.cc" /* yacc.c:1646 */ 7768 7768 break; 7769 7769 7770 case 6 78:7771 #line 2 593"parser.yy" /* yacc.c:1646 */7772 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); }7770 case 681: 7771 #line 2605 "parser.yy" /* yacc.c:1646 */ 7772 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[-3].decl) ); } 7773 7773 #line 7774 "Parser/parser.cc" /* yacc.c:1646 */ 7774 7774 break; 7775 7775 7776 case 68 0:7777 #line 260 4"parser.yy" /* yacc.c:1646 */7778 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }7776 case 682: 7777 #line 2607 "parser.yy" /* yacc.c:1646 */ 7778 { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[-2].decl), false ); } 7779 7779 #line 7780 "Parser/parser.cc" /* yacc.c:1646 */ 7780 7780 break; 7781 7781 7782 case 68 1:7783 #line 26 07"parser.yy" /* yacc.c:1646 */7784 { (yyval.decl) = DeclarationNode::new VarArray( (yyvsp[-3].decl)); }7782 case 683: 7783 #line 2610 "parser.yy" /* yacc.c:1646 */ 7784 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), false ); } 7785 7785 #line 7786 "Parser/parser.cc" /* yacc.c:1646 */ 7786 7786 break; 7787 7787 7788 case 68 2:7789 #line 26 09"parser.yy" /* yacc.c:1646 */7790 { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[-2].decl), false ); }7788 case 684: 7789 #line 2612 "parser.yy" /* yacc.c:1646 */ 7790 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), true ); } 7791 7791 #line 7792 "Parser/parser.cc" /* yacc.c:1646 */ 7792 7792 break; 7793 7793 7794 case 68 3:7795 #line 261 2"parser.yy" /* yacc.c:1646 */7796 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[- 3].decl), false ); }7794 case 685: 7795 #line 2614 "parser.yy" /* yacc.c:1646 */ 7796 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-4].decl), true ); } 7797 7797 #line 7798 "Parser/parser.cc" /* yacc.c:1646 */ 7798 7798 break; 7799 7799 7800 case 68 4:7801 #line 26 14"parser.yy" /* yacc.c:1646 */7802 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), true); }7800 case 687: 7801 #line 2628 "parser.yy" /* yacc.c:1646 */ 7802 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7803 7803 #line 7804 "Parser/parser.cc" /* yacc.c:1646 */ 7804 7804 break; 7805 7805 7806 case 685: 7807 #line 2616 "parser.yy" /* yacc.c:1646 */ 7808 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-4].decl), true ); } 7809 #line 7810 "Parser/parser.cc" /* yacc.c:1646 */ 7810 break; 7811 7812 case 687: 7806 case 688: 7813 7807 #line 2630 "parser.yy" /* yacc.c:1646 */ 7814 7808 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7809 #line 7810 "Parser/parser.cc" /* yacc.c:1646 */ 7810 break; 7811 7812 case 689: 7813 #line 2635 "parser.yy" /* yacc.c:1646 */ 7814 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 7815 7815 #line 7816 "Parser/parser.cc" /* yacc.c:1646 */ 7816 7816 break; 7817 7817 7818 case 6 88:7819 #line 263 2"parser.yy" /* yacc.c:1646 */7820 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7818 case 690: 7819 #line 2637 "parser.yy" /* yacc.c:1646 */ 7820 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); } 7821 7821 #line 7822 "Parser/parser.cc" /* yacc.c:1646 */ 7822 7822 break; 7823 7823 7824 case 6 89:7825 #line 263 7"parser.yy" /* yacc.c:1646 */7826 { (yyval.decl) = DeclarationNode::newPointer( 0); }7824 case 691: 7825 #line 2639 "parser.yy" /* yacc.c:1646 */ 7826 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7827 7827 #line 7828 "Parser/parser.cc" /* yacc.c:1646 */ 7828 7828 break; 7829 7829 7830 case 69 0:7831 #line 26 39"parser.yy" /* yacc.c:1646 */7832 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); }7830 case 692: 7831 #line 2641 "parser.yy" /* yacc.c:1646 */ 7832 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7833 7833 #line 7834 "Parser/parser.cc" /* yacc.c:1646 */ 7834 7834 break; 7835 7835 7836 case 69 1:7837 #line 264 1"parser.yy" /* yacc.c:1646 */7838 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( 0 )); }7836 case 693: 7837 #line 2643 "parser.yy" /* yacc.c:1646 */ 7838 { (yyval.decl) = (yyvsp[-1].decl); } 7839 7839 #line 7840 "Parser/parser.cc" /* yacc.c:1646 */ 7840 7840 break; 7841 7841 7842 case 69 2:7843 #line 264 3"parser.yy" /* yacc.c:1646 */7844 { (yyval.decl) = (yyvsp[ 0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl)) ); }7842 case 695: 7843 #line 2649 "parser.yy" /* yacc.c:1646 */ 7844 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7845 7845 #line 7846 "Parser/parser.cc" /* yacc.c:1646 */ 7846 7846 break; 7847 7847 7848 case 693: 7849 #line 2645 "parser.yy" /* yacc.c:1646 */ 7850 { (yyval.decl) = (yyvsp[-1].decl); } 7851 #line 7852 "Parser/parser.cc" /* yacc.c:1646 */ 7852 break; 7853 7854 case 695: 7848 case 696: 7855 7849 #line 2651 "parser.yy" /* yacc.c:1646 */ 7856 7850 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7851 #line 7852 "Parser/parser.cc" /* yacc.c:1646 */ 7852 break; 7853 7854 case 697: 7855 #line 2653 "parser.yy" /* yacc.c:1646 */ 7856 { (yyval.decl) = (yyvsp[-1].decl); } 7857 7857 #line 7858 "Parser/parser.cc" /* yacc.c:1646 */ 7858 7858 break; 7859 7859 7860 case 69 6:7861 #line 265 3"parser.yy" /* yacc.c:1646 */7862 { (yyval.decl) = (yyvsp[- 2].decl)->addArray( (yyvsp[0].decl) ); }7860 case 698: 7861 #line 2658 "parser.yy" /* yacc.c:1646 */ 7862 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7863 7863 #line 7864 "Parser/parser.cc" /* yacc.c:1646 */ 7864 7864 break; 7865 7865 7866 case 69 7:7867 #line 26 55"parser.yy" /* yacc.c:1646 */7866 case 699: 7867 #line 2660 "parser.yy" /* yacc.c:1646 */ 7868 7868 { (yyval.decl) = (yyvsp[-1].decl); } 7869 7869 #line 7870 "Parser/parser.cc" /* yacc.c:1646 */ 7870 7870 break; 7871 7871 7872 case 698:7873 #line 26 60 "parser.yy" /* yacc.c:1646 */7874 { (yyval.decl) = (yyvsp[ -6].decl)->addParamList( (yyvsp[-2].decl) ); }7872 case 702: 7873 #line 2670 "parser.yy" /* yacc.c:1646 */ 7874 { (yyval.decl) = (yyvsp[0].decl)->addQualifiers( (yyvsp[-1].decl) ); } 7875 7875 #line 7876 "Parser/parser.cc" /* yacc.c:1646 */ 7876 7876 break; 7877 7877 7878 case 699:7879 #line 26 62"parser.yy" /* yacc.c:1646 */7880 { (yyval.decl) = (yyvsp[ -1].decl); }7878 case 705: 7879 #line 2680 "parser.yy" /* yacc.c:1646 */ 7880 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 7881 7881 #line 7882 "Parser/parser.cc" /* yacc.c:1646 */ 7882 7882 break; 7883 7883 7884 case 70 2:7885 #line 26 72 "parser.yy" /* yacc.c:1646 */7886 { (yyval.decl) = (yyvsp[0].decl)->add Qualifiers( (yyvsp[-1].decl) ); }7884 case 706: 7885 #line 2682 "parser.yy" /* yacc.c:1646 */ 7886 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 7887 7887 #line 7888 "Parser/parser.cc" /* yacc.c:1646 */ 7888 7888 break; 7889 7889 7890 case 70 5:7891 #line 268 2"parser.yy" /* yacc.c:1646 */7890 case 707: 7891 #line 2684 "parser.yy" /* yacc.c:1646 */ 7892 7892 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 7893 7893 #line 7894 "Parser/parser.cc" /* yacc.c:1646 */ 7894 7894 break; 7895 7895 7896 case 70 6:7897 #line 268 4"parser.yy" /* yacc.c:1646 */7896 case 708: 7897 #line 2686 "parser.yy" /* yacc.c:1646 */ 7898 7898 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 7899 7899 #line 7900 "Parser/parser.cc" /* yacc.c:1646 */ 7900 7900 break; 7901 7901 7902 case 70 7:7903 #line 268 6"parser.yy" /* yacc.c:1646 */7902 case 709: 7903 #line 2688 "parser.yy" /* yacc.c:1646 */ 7904 7904 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 7905 7905 #line 7906 "Parser/parser.cc" /* yacc.c:1646 */ 7906 7906 break; 7907 7907 7908 case 7 08:7909 #line 26 88"parser.yy" /* yacc.c:1646 */7908 case 710: 7909 #line 2690 "parser.yy" /* yacc.c:1646 */ 7910 7910 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 7911 7911 #line 7912 "Parser/parser.cc" /* yacc.c:1646 */ 7912 7912 break; 7913 7913 7914 case 7 09:7915 #line 269 0"parser.yy" /* yacc.c:1646 */7916 { (yyval.decl) = (yyvsp[0].decl)->addNew Pointer( DeclarationNode::newPointer( 0) ); }7914 case 711: 7915 #line 2697 "parser.yy" /* yacc.c:1646 */ 7916 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7917 7917 #line 7918 "Parser/parser.cc" /* yacc.c:1646 */ 7918 7918 break; 7919 7919 7920 case 71 0:7921 #line 269 2"parser.yy" /* yacc.c:1646 */7922 { (yyval.decl) = (yyvsp[0].decl)->addNew Pointer( DeclarationNode::newPointer( (yyvsp[-2].decl)) ); }7920 case 712: 7921 #line 2699 "parser.yy" /* yacc.c:1646 */ 7922 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 7923 7923 #line 7924 "Parser/parser.cc" /* yacc.c:1646 */ 7924 7924 break; 7925 7925 7926 case 711: 7927 #line 2699 "parser.yy" /* yacc.c:1646 */ 7926 case 713: 7927 #line 2701 "parser.yy" /* yacc.c:1646 */ 7928 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7929 #line 7930 "Parser/parser.cc" /* yacc.c:1646 */ 7930 break; 7931 7932 case 714: 7933 #line 2703 "parser.yy" /* yacc.c:1646 */ 7934 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( (yyvsp[-2].decl) ); } 7935 #line 7936 "Parser/parser.cc" /* yacc.c:1646 */ 7936 break; 7937 7938 case 715: 7939 #line 2705 "parser.yy" /* yacc.c:1646 */ 7940 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 7941 #line 7942 "Parser/parser.cc" /* yacc.c:1646 */ 7942 break; 7943 7944 case 716: 7945 #line 2707 "parser.yy" /* yacc.c:1646 */ 7928 7946 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7929 #line 7930 "Parser/parser.cc" /* yacc.c:1646 */7930 break;7931 7932 case 712:7933 #line 2701 "parser.yy" /* yacc.c:1646 */7934 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); }7935 #line 7936 "Parser/parser.cc" /* yacc.c:1646 */7936 break;7937 7938 case 713:7939 #line 2703 "parser.yy" /* yacc.c:1646 */7940 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }7941 #line 7942 "Parser/parser.cc" /* yacc.c:1646 */7942 break;7943 7944 case 714:7945 #line 2705 "parser.yy" /* yacc.c:1646 */7946 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( (yyvsp[-2].decl) ); }7947 7947 #line 7948 "Parser/parser.cc" /* yacc.c:1646 */ 7948 7948 break; 7949 7949 7950 case 71 5:7951 #line 270 7"parser.yy" /* yacc.c:1646 */7950 case 717: 7951 #line 2709 "parser.yy" /* yacc.c:1646 */ 7952 7952 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 7953 7953 #line 7954 "Parser/parser.cc" /* yacc.c:1646 */ 7954 7954 break; 7955 7955 7956 case 71 6:7957 #line 27 09"parser.yy" /* yacc.c:1646 */7958 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }7956 case 718: 7957 #line 2711 "parser.yy" /* yacc.c:1646 */ 7958 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7959 7959 #line 7960 "Parser/parser.cc" /* yacc.c:1646 */ 7960 7960 break; 7961 7961 7962 case 717: 7963 #line 2711 "parser.yy" /* yacc.c:1646 */ 7962 case 719: 7963 #line 2713 "parser.yy" /* yacc.c:1646 */ 7964 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( (yyvsp[-2].decl) ); } 7965 #line 7966 "Parser/parser.cc" /* yacc.c:1646 */ 7966 break; 7967 7968 case 720: 7969 #line 2715 "parser.yy" /* yacc.c:1646 */ 7964 7970 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 7965 #line 7966 "Parser/parser.cc" /* yacc.c:1646 */7966 break;7967 7968 case 718:7969 #line 2713 "parser.yy" /* yacc.c:1646 */7970 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }7971 7971 #line 7972 "Parser/parser.cc" /* yacc.c:1646 */ 7972 7972 break; 7973 7973 7974 case 7 19:7975 #line 27 15"parser.yy" /* yacc.c:1646 */7976 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( (yyvsp[-2].decl) ); }7974 case 721: 7975 #line 2720 "parser.yy" /* yacc.c:1646 */ 7976 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[-3].decl) ); } 7977 7977 #line 7978 "Parser/parser.cc" /* yacc.c:1646 */ 7978 7978 break; 7979 7979 7980 case 72 0:7981 #line 27 17"parser.yy" /* yacc.c:1646 */7982 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl)); }7980 case 722: 7981 #line 2722 "parser.yy" /* yacc.c:1646 */ 7982 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), false ); } 7983 7983 #line 7984 "Parser/parser.cc" /* yacc.c:1646 */ 7984 7984 break; 7985 7985 7986 case 72 1:7987 #line 272 2"parser.yy" /* yacc.c:1646 */7988 { (yyval.decl) = DeclarationNode::new VarArray( (yyvsp[-3].decl)); }7986 case 723: 7987 #line 2727 "parser.yy" /* yacc.c:1646 */ 7988 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), true ); } 7989 7989 #line 7990 "Parser/parser.cc" /* yacc.c:1646 */ 7990 7990 break; 7991 7991 7992 case 72 2:7993 #line 272 4"parser.yy" /* yacc.c:1646 */7994 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl) , false ); }7992 case 724: 7993 #line 2729 "parser.yy" /* yacc.c:1646 */ 7994 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl)->addQualifiers( (yyvsp[-4].decl) ), true ); } 7995 7995 #line 7996 "Parser/parser.cc" /* yacc.c:1646 */ 7996 7996 break; 7997 7997 7998 case 72 3:7999 #line 27 29"parser.yy" /* yacc.c:1646 */8000 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), true); }7998 case 726: 7999 #line 2756 "parser.yy" /* yacc.c:1646 */ 8000 { (yyval.decl) = (yyvsp[0].decl)->addQualifiers( (yyvsp[-1].decl) ); } 8001 8001 #line 8002 "Parser/parser.cc" /* yacc.c:1646 */ 8002 8002 break; 8003 8003 8004 case 7 24:8005 #line 27 31"parser.yy" /* yacc.c:1646 */8006 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl)->addQualifiers( (yyvsp[-4].decl) ), true); }8004 case 730: 8005 #line 2767 "parser.yy" /* yacc.c:1646 */ 8006 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8007 8007 #line 8008 "Parser/parser.cc" /* yacc.c:1646 */ 8008 8008 break; 8009 8009 8010 case 7 26:8011 #line 27 58"parser.yy" /* yacc.c:1646 */8012 { (yyval.decl) = (yyvsp[0].decl)->add Qualifiers( (yyvsp[-1].decl) ); }8010 case 731: 8011 #line 2769 "parser.yy" /* yacc.c:1646 */ 8012 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 8013 8013 #line 8014 "Parser/parser.cc" /* yacc.c:1646 */ 8014 8014 break; 8015 8015 8016 case 73 0:8017 #line 27 69"parser.yy" /* yacc.c:1646 */8016 case 732: 8017 #line 2771 "parser.yy" /* yacc.c:1646 */ 8018 8018 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8019 8019 #line 8020 "Parser/parser.cc" /* yacc.c:1646 */ 8020 8020 break; 8021 8021 8022 case 73 1:8023 #line 277 1"parser.yy" /* yacc.c:1646 */8022 case 733: 8023 #line 2773 "parser.yy" /* yacc.c:1646 */ 8024 8024 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 8025 8025 #line 8026 "Parser/parser.cc" /* yacc.c:1646 */ 8026 8026 break; 8027 8027 8028 case 73 2:8029 #line 277 3"parser.yy" /* yacc.c:1646 */8028 case 734: 8029 #line 2775 "parser.yy" /* yacc.c:1646 */ 8030 8030 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8031 8031 #line 8032 "Parser/parser.cc" /* yacc.c:1646 */ 8032 8032 break; 8033 8033 8034 case 73 3:8035 #line 277 5"parser.yy" /* yacc.c:1646 */8034 case 735: 8035 #line 2777 "parser.yy" /* yacc.c:1646 */ 8036 8036 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 8037 8037 #line 8038 "Parser/parser.cc" /* yacc.c:1646 */ 8038 8038 break; 8039 8039 8040 case 73 4:8041 #line 27 77"parser.yy" /* yacc.c:1646 */8042 { (yyval.decl) = (yyvsp[0].decl)->addNew Pointer( DeclarationNode::newPointer( 0) ); }8040 case 736: 8041 #line 2784 "parser.yy" /* yacc.c:1646 */ 8042 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8043 8043 #line 8044 "Parser/parser.cc" /* yacc.c:1646 */ 8044 8044 break; 8045 8045 8046 case 73 5:8047 #line 27 79"parser.yy" /* yacc.c:1646 */8048 { (yyval.decl) = (yyvsp[0].decl)->addNew Pointer( DeclarationNode::newPointer( (yyvsp[-2].decl)) ); }8046 case 737: 8047 #line 2786 "parser.yy" /* yacc.c:1646 */ 8048 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8049 8049 #line 8050 "Parser/parser.cc" /* yacc.c:1646 */ 8050 8050 break; 8051 8051 8052 case 736: 8053 #line 2786 "parser.yy" /* yacc.c:1646 */ 8052 case 738: 8053 #line 2788 "parser.yy" /* yacc.c:1646 */ 8054 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 8055 #line 8056 "Parser/parser.cc" /* yacc.c:1646 */ 8056 break; 8057 8058 case 739: 8059 #line 2790 "parser.yy" /* yacc.c:1646 */ 8054 8060 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8055 #line 80 56"Parser/parser.cc" /* yacc.c:1646 */8056 break; 8057 8058 case 7 37:8059 #line 27 88"parser.yy" /* yacc.c:1646 */8061 #line 8062 "Parser/parser.cc" /* yacc.c:1646 */ 8062 break; 8063 8064 case 740: 8065 #line 2792 "parser.yy" /* yacc.c:1646 */ 8060 8066 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8061 #line 806 2"Parser/parser.cc" /* yacc.c:1646 */8062 break; 8063 8064 case 7 38:8065 #line 279 0"parser.yy" /* yacc.c:1646 */8067 #line 8068 "Parser/parser.cc" /* yacc.c:1646 */ 8068 break; 8069 8070 case 741: 8071 #line 2794 "parser.yy" /* yacc.c:1646 */ 8066 8072 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 8067 #line 8068 "Parser/parser.cc" /* yacc.c:1646 */8068 break;8069 8070 case 739:8071 #line 2792 "parser.yy" /* yacc.c:1646 */8072 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }8073 8073 #line 8074 "Parser/parser.cc" /* yacc.c:1646 */ 8074 8074 break; 8075 8075 8076 case 74 0:8077 #line 279 4"parser.yy" /* yacc.c:1646 */8078 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false) ); }8076 case 742: 8077 #line 2799 "parser.yy" /* yacc.c:1646 */ 8078 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[-2].decl) ); } 8079 8079 #line 8080 "Parser/parser.cc" /* yacc.c:1646 */ 8080 8080 break; 8081 8081 8082 case 74 1:8083 #line 2 796"parser.yy" /* yacc.c:1646 */8084 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl)); }8082 case 743: 8083 #line 2804 "parser.yy" /* yacc.c:1646 */ 8084 { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[-1].decl), 0 ); } 8085 8085 #line 8086 "Parser/parser.cc" /* yacc.c:1646 */ 8086 8086 break; 8087 8087 8088 case 74 2:8089 #line 280 1"parser.yy" /* yacc.c:1646 */8090 { (yyval.decl) = DeclarationNode::new Tuple( (yyvsp[-2].decl)); }8088 case 744: 8089 #line 2806 "parser.yy" /* yacc.c:1646 */ 8090 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[-5].decl), (yyvsp[-2].decl), 0 ); } 8091 8091 #line 8092 "Parser/parser.cc" /* yacc.c:1646 */ 8092 8092 break; 8093 8093 8094 case 743: 8095 #line 2806 "parser.yy" /* yacc.c:1646 */ 8096 { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[-1].decl), 0 ); } 8097 #line 8098 "Parser/parser.cc" /* yacc.c:1646 */ 8098 break; 8099 8100 case 744: 8094 case 745: 8101 8095 #line 2808 "parser.yy" /* yacc.c:1646 */ 8102 8096 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[-5].decl), (yyvsp[-2].decl), 0 ); } 8097 #line 8098 "Parser/parser.cc" /* yacc.c:1646 */ 8098 break; 8099 8100 case 748: 8101 #line 2832 "parser.yy" /* yacc.c:1646 */ 8102 { (yyval.en) = 0; } 8103 8103 #line 8104 "Parser/parser.cc" /* yacc.c:1646 */ 8104 8104 break; 8105 8105 8106 case 74 5:8107 #line 28 10"parser.yy" /* yacc.c:1646 */8108 { (yyval. decl) = DeclarationNode::newFunction( 0, (yyvsp[-5].decl), (yyvsp[-2].decl), 0); }8106 case 749: 8107 #line 2834 "parser.yy" /* yacc.c:1646 */ 8108 { (yyval.en) = (yyvsp[0].en); } 8109 8109 #line 8110 "Parser/parser.cc" /* yacc.c:1646 */ 8110 8110 break; 8111 8111 8112 case 748: 8113 #line 2834 "parser.yy" /* yacc.c:1646 */ 8114 { (yyval.en) = 0; } 8115 #line 8116 "Parser/parser.cc" /* yacc.c:1646 */ 8116 break; 8117 8118 case 749: 8119 #line 2836 "parser.yy" /* yacc.c:1646 */ 8120 { (yyval.en) = (yyvsp[0].en); } 8121 #line 8122 "Parser/parser.cc" /* yacc.c:1646 */ 8122 break; 8123 8124 8125 #line 8126 "Parser/parser.cc" /* yacc.c:1646 */ 8112 8113 #line 8114 "Parser/parser.cc" /* yacc.c:1646 */ 8126 8114 default: break; 8127 8115 } … … 8351 8339 return yyresult; 8352 8340 } 8353 #line 283 9"parser.yy" /* yacc.c:1906 */8341 #line 2837 "parser.yy" /* yacc.c:1906 */ 8354 8342 8355 8343 // ----end of grammar---- -
src/Parser/parser.yy
re85a8631 r04cdd9b 2105 2105 // empty 2106 2106 | ASM '(' string_literal_list ')' attribute_list_opt 2107 { delete $3; }2108 2107 ; 2109 2108 … … 2135 2134 | any_word 2136 2135 | any_word '(' comma_expression_opt ')' 2137 { delete $3; }2138 2136 ; 2139 2137 2140 2138 any_word: // GCC 2141 identifier_or_type_name { delete $1;}2142 | storage_class { delete $1;}2143 | basic_type_name { delete $1;}2144 | type_qualifier { delete $1;}2139 identifier_or_type_name {} 2140 | storage_class {} 2141 | basic_type_name {} 2142 | type_qualifier {} 2145 2143 ; 2146 2144 -
src/SynTree/Expression.cc
re85a8631 r04cdd9b 385 385 UntypedExpr::~UntypedExpr() { 386 386 delete function; 387 // deleteAll( args ); //TODO FIXME the arguments are leaked but they seem to be shared in some way388 387 } 389 388 -
src/SynTree/FunctionDecl.cc
re85a8631 r04cdd9b 39 39 delete type; 40 40 delete statements; 41 deleteAll( oldDecls );42 41 } 43 42 -
src/SynTree/Statement.cc
re85a8631 r04cdd9b 159 159 delete condition; 160 160 // destroy statements 161 deleteAll( statements );162 161 } 163 162 … … 188 187 CaseStmt::~CaseStmt() { 189 188 delete condition; 190 deleteAll( stmts );191 189 } 192 190 … … 222 220 WhileStmt::~WhileStmt() { 223 221 delete body; 224 delete condition;225 222 } 226 223 … … 297 294 TryStmt::~TryStmt() { 298 295 delete block; 299 deleteAll( handlers );300 delete finallyBlock;301 296 } 302 297 -
src/include/assert.h
re85a8631 r04cdd9b 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // assert.h -- 8 // 6 // 7 // assert.h -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Aug 18 13:19:26 2016 … … 12 12 // Last Modified On : Thu Aug 18 13:25:55 2016 13 13 // Update Count : 4 14 // 15 16 #pragma once 14 // 17 15 18 16 #include_next <assert.h> … … 24 22 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ); 25 23 26 template<typename T, typename U>27 static inline T safe_dynamic_cast(const U& src) {28 T ret = dynamic_cast<T>(src);29 assert(ret);30 return ret;31 }32 33 24 // Local Variables: // 34 25 // tab-width: 4 // -
src/main.cc
re85a8631 r04cdd9b 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 20 12:52:22 201613 // Update Count : 40312 // Last Modified On : Fri Aug 19 08:31:22 2016 13 // Update Count : 350 14 14 // 15 15 16 16 #include <iostream> 17 17 #include <fstream> 18 #include <signal.h> // signal 19 #include <getopt.h> // getopt 20 #include <execinfo.h> // backtrace, backtrace_symbols_fd 21 #include <cxxabi.h> // __cxa_demangle 22 23 using namespace std; 24 18 #include <getopt.h> 25 19 #include "Parser/lex.h" 26 20 #include "Parser/parser.h" … … 41 35 #include "InitTweak/FixInit.h" 42 36 #include "Common/UnimplementedError.h" 37 43 38 #include "../config.h" 44 39 45 40 using namespace std; 46 41 47 #define OPTPRINT(x) if ( errorp ) cerr << x <<endl;42 #define OPTPRINT(x) if ( errorp ) std::cerr << x << std::endl; 48 43 49 44 … … 73 68 static void parse_cmdline( int argc, char *argv[], const char *& filename ); 74 69 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false ); 75 static void dump( list< Declaration * > & translationUnit, ostream & out = cout ); 76 77 void sigSegvBusHandler( int sig_num ) { 78 enum { Frames = 50 }; 79 void * array[Frames]; 80 int size = backtrace( array, Frames ); 81 82 cerr << "*CFA runtime error* program cfa-cpp terminated with " 83 << (sig_num == SIGSEGV ? "segment fault" : "bus error") 84 << " backtrace:" << endl; 85 86 char ** messages = backtrace_symbols( array, size ); 87 88 // skip first stack frame (points here) 89 for ( int i = 2; i < size - 2 && messages != nullptr; i += 1 ) { 90 char * mangled_name = nullptr, * offset_begin = nullptr, * offset_end = nullptr; 91 for ( char *p = messages[i]; *p; ++p ) { // find parantheses and +offset 92 if (*p == '(') { 93 mangled_name = p; 94 } else if (*p == '+') { 95 offset_begin = p; 96 } else if (*p == ')') { 97 offset_end = p; 98 break; 99 } // if 100 } // for 101 102 // if line contains symbol, attempt to demangle 103 if ( mangled_name && offset_begin && offset_end && mangled_name < offset_begin ) { 104 *mangled_name++ = '\0'; 105 *offset_begin++ = '\0'; 106 *offset_end++ = '\0'; 107 108 int status; 109 char * real_name = __cxxabiv1::__cxa_demangle( mangled_name, 0, 0, &status ); 110 if ( status == 0 ) { // demangling successful ? 111 cerr << "(" << i - 2 << ") " << messages[i] << " : " 112 << real_name << "+" << offset_begin << offset_end << endl; 113 114 } else { // otherwise, output mangled name 115 cerr << "(" << i - 2 << ") " << messages[i] << " : " 116 << mangled_name << "+" << offset_begin << offset_end << endl; 117 } // if 118 free( real_name ); 119 } else { // otherwise, print the whole line 120 cerr << "(" << i - 2 << ") " << messages[i] << endl; 121 } // if 122 } // for 123 free( messages ); 124 exit( EXIT_FAILURE ); 125 } // sigSegvBusHandler 70 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out = std::cout ); 126 71 127 72 int main( int argc, char * argv[] ) { 128 73 FILE * input; // use FILE rather than istream because yyin is FILE 129 ostream *output = & cout; 74 std::ostream *output = & std::cout; 75 std::list< Declaration * > translationUnit; 130 76 const char *filename = nullptr; 131 list< Declaration * > translationUnit;132 133 signal( SIGSEGV, sigSegvBusHandler );134 signal( SIGBUS, sigSegvBusHandler );135 77 136 78 parse_cmdline( argc, argv, filename ); // process command-line arguments … … 180 122 181 123 if ( parsep ) { 182 parseTree->printList( cout );124 parseTree->printList( std::cout ); 183 125 delete parseTree; 184 126 return 0; … … 202 144 203 145 if ( expraltp ) { 204 ResolvExpr::AlternativePrinter printer( cout );146 ResolvExpr::AlternativePrinter printer( std::cout ); 205 147 acceptAll( translationUnit, printer ); 206 148 return 0; … … 268 210 CodeGen::generate( translationUnit, *output, ! noprotop ); 269 211 270 if ( output != & cout ) {212 if ( output != &std::cout ) { 271 213 delete output; 272 214 } // if 273 215 } catch ( SemanticError &e ) { 274 216 if ( errorp ) { 275 cerr << "---AST at error:---" <<endl;276 dump( translationUnit, cerr );277 cerr << endl << "---End of AST, begin error message:---\n" <<endl;278 } // if 279 e.print( cerr );280 if ( output != & cout ) {217 std::cerr << "---AST at error:---" << std::endl; 218 dump( translationUnit, std::cerr ); 219 std::cerr << std::endl << "---End of AST, begin error message:---\n" << std::endl; 220 } // if 221 e.print( std::cerr ); 222 if ( output != &std::cout ) { 281 223 delete output; 282 224 } // if 283 225 return 1; 284 226 } catch ( UnimplementedError &e ) { 285 cout << "Sorry, " << e.get_what() << " is not currently implemented" <<endl;286 if ( output != & cout ) {227 std::cout << "Sorry, " << e.get_what() << " is not currently implemented" << std::endl; 228 if ( output != &std::cout ) { 287 229 delete output; 288 230 } // if 289 231 return 1; 290 232 } catch ( CompilerError &e ) { 291 cerr << "Compiler Error: " << e.get_what() <<endl;292 cerr << "(please report bugs to " <<endl;293 if ( output != & cout ) {233 std::cerr << "Compiler Error: " << e.get_what() << std::endl; 234 std::cerr << "(please report bugs to " << std::endl; 235 if ( output != &std::cout ) { 294 236 delete output; 295 237 } // if … … 427 369 } // notPrelude 428 370 429 static void dump( list< Declaration * > & translationUnit,ostream & out ) {430 list< Declaration * > decls;371 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out ) { 372 std::list< Declaration * > decls; 431 373 432 374 if ( noprotop ) { 433 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), notPrelude );375 filter( translationUnit.begin(), translationUnit.end(), std::back_inserter( decls ), notPrelude ); 434 376 } else { 435 377 decls = translationUnit;
Note:
See TracChangeset
for help on using the changeset viewer.