Changeset e85a8631
- Timestamp:
- Aug 22, 2016, 2:15:19 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- f87408e
- Parents:
- 04cdd9b (diff), 8d2844a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/aaron_comp_II/comp_II.tex
r04cdd9b re85a8631 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 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 muchmore complex type-system.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 significantly 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 alsoprovides 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 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 to©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 of ©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 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 \emph{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 M aa = abs(a), ab = abs(b); 173 return aa < ab ? b : a; 172 return abs(a) < abs(b) ? b : a; 174 173 } 175 174 \end{lstlisting} 176 175 177 176 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. 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 i nterface implementationin Go, as opposed to the nominal inheritance model of Java and \CC.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 implementation of an interface in Go, as opposed to the nominal inheritance model of Java and \CC. 179 178 Nominal inheritance can be simulated with traits using marker variables or functions: 180 179 \begin{lstlisting} … … 190 189 \end{lstlisting} 191 190 192 Traits, however, are significantly more powerful than nominal-inheritance interfaces; firstly, due to the scoping rules of the declarations whichsatisfy 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 whichmay be difficult or impossible to represent in nominal-inheritance type systems:191 Traits, however, are significantly more powerful than nominal-inheritance interfaces; firstly, due to the scoping rules of the declarations that 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. 192 Secondly, traits may be used to declare a relationship among multiple types, a property that may be difficult or impossible to represent in nominal-inheritance type systems: 194 193 \begin{lstlisting} 195 194 trait pointer_like(®otype Ptr, otype El®) { … … 202 201 }; 203 202 204 typedef list *list_iterator;203 typedef list *list_iterator; 205 204 206 205 lvalue int *?( list_iterator it ) { … … 209 208 \end{lstlisting} 210 209 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. 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©). 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 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 ouldlead 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 can 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 makes finding the proper declaration to match to a variable expression or function application a simple matter of symboltable lookup, which can be easily and efficiently implemented.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. 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 7232 max(max, 3.14); // uses (2) and (4), by matching double type of 3.14231 max(7, -max); // uses (1) and (3), by matching int type of the constant 7 232 max(max, 3.14); // uses (2) and (4), by matching double type of the constant 3.14 233 233 234 234 max(max, -max); // ERROR: ambiguous 235 int m = max(max, -max); // uses (1) and (3) twice, byreturn type235 int m = max(max, -max); // uses (1) once and (3) twice, by matching 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 also supports all of the implicit conversions present in C, producing further candidate interpretations for expressions.242 C does not have a traditionally-definedinheritance 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.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. 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 ©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).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). 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} haslaid out a framework for using polymorphic-conversion-constructor functions to create a directed acyclic graph (DAG) of conversions.254 Ditchfield~\cite{Ditchfield:conversions} 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 as path length through the DAG.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. 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.} 260 \caption{A portion of the implicit conversion DAG for built-in types.}\label{fig:conv_dag} 261 261 \end{figure} 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 beimpossible 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 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 it 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 canbe usefully augmented to include user-defined types as well as built-in types?268 \item Can the graph canbe efficiently represented and used in the expression resolver?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? 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; 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. 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. 275 276 The following example shows the implicitly-generated code in green: 276 277 \begin{lstlisting} … … 280 281 }; 281 282 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);283 ¢void ?{}(kv *this) { // default constructor 284 ?{}(&(this->key)); // call recursively on members 285 ?{}(&(this->value)); 286 } 287 void ?{}(kv *this, kv that) { // copy constructor 288 ?{}(&(this->key), that.key); 289 ?{}(&(this->value), that.value); 290 } 291 kv ?=?(kv *this, kv that) { // assignment operator 292 ?=?(&(this->key), that.key); 293 ?=?(&(this->value), that.value); 293 294 return *this; 294 295 } 295 void ^?{}(kv *this) { 296 ^?{}(& this->key);297 ^?{}(& this->value);296 void ^?{}(kv *this) { // destructor 297 ^?{}(&(this->key)); 298 ^?{}(&(this->value)); 298 299 }¢ 299 300 … … 335 336 \begin{itemize} 336 337 \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)©. 337 \item To determine the cost of the ©box(S)© interpretation, a type must be found for ©S© whichsatisfies the ©otype© implicit type assertions (assignment operator, default and copy constructors, and destructor); one option is ©box(S2)© for some type ©S2©.338 \item To determine the cost of the ©box(S)© interpretation, a type must be found for ©S© that satisfies the ©otype© implicit type assertions (assignment operator, default and copy constructors, and destructor); one option is ©box(S2)© for some type ©S2©. 338 339 \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©. 339 340 \item The previous step repeats until stopped, with four times as much work performed at each step. 340 341 \end{itemize} 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. 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. 342 344 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. 343 345 … … 345 347 \CFA adds \emph{tuple types} to C, a syntactic facility for referring to lists of values anonymously or with a single identifier. 346 348 An identifier may name a tuple, and a function may return one. 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]; } 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) 353 355 354 356 x = swap( x ); // destructure [char, char] x into two elements of parameter list 355 357 // cannot use int x for parameter, not enough arguments to swap 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. 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. 358 366 359 367 \subsection{Reference Types} 360 368 I have been designing \emph{reference types} for \CFA, in collaboration with the rest of the \CFA research team. 361 369 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. 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: 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: 364 373 \begin{lstlisting} 365 374 const int magic = 42; … … 369 378 print_inc( magic ); // legal; implicitly generated code in green below: 370 379 371 ¢int tmp = magic;¢ // copiesto safely strip const-qualifier380 ¢int tmp = magic;¢ // to safely strip const-qualifier 372 381 ¢print_inc( tmp );¢ // tmp is incremented, magic is unchanged 373 382 \end{lstlisting} 374 These reference conversions may also chain with the other implicit type 375 The main implication of th is 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.383 These reference conversions may also chain with the other implicit type-conversions. 384 The main implication of the 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. 376 385 377 386 \subsection{Special Literal Types} 378 387 Another proposal currently under consideration for the \CFA type-system is assigning special types to the literal values ©0© and ©1©. 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 preci cely.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 precisely. 380 389 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. 381 390 The main implication for expression resolution is that the frequently encountered expressions ©0© and ©1© may have a large number of valid interpretations. … … 386 395 int somefn(char) = delete; 387 396 \end{lstlisting} 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.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. 390 399 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. 391 400 … … 404 413 %TODO: look up and lit review 405 414 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. 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 dependencythat the problem is not trivial.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 dependencies that the problem is not trivial. 407 416 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. 408 417 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. … … 412 421 413 422 \subsection{Argument-Parameter Matching} 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.423 The first axis for consideration is the 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. 415 424 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. 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: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}: 417 426 \begin{figure}[h] 418 427 \centering … … 433 442 \end{figure} 434 443 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 containingexpression.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. 436 445 437 446 \subsubsection{Argument-directed (Bottom-up)} … … 451 460 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. 452 461 This approach may involve switching from one type to another at different levels of the expression tree. 453 For instance :462 For instance, in: 454 463 \begin{lstlisting} 455 464 forall(otype T) … … 460 469 int x = f( f( '!' ) ); 461 470 \end{lstlisting} 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. 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. 465 475 466 476 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. 467 477 Persch~\etal~\cite{PW:overload} developed a similar two-pass approach where the bottom-up pass is followed by the top-down pass. 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 theyapply 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.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 also 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. 469 479 470 480 \subsubsection{Common Subexpression Caching} … … 480 490 \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. 481 491 The upcoming Concepts standard~\cite{C++concepts} defines a system of type constraints similar in principle to \CFA's. 482 Cormack and Wright~\cite{Cormack90} present an algorithm whichintegrates overload resolution with a polymorphic type inference approach very similar to \CFA's.492 Cormack and Wright~\cite{Cormack90} present an algorithm that integrates overload resolution with a polymorphic type inference approach very similar to \CFA's. 483 493 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.}. 484 494 … … 486 496 Bilson does account for implicit conversions in his algorithm, but it is unclear if the approach is optimal. 487 497 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. 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. 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. 490 499 491 500 \subsubsection{On Arguments} 492 501 Another approach is to generate a set of possible implicit conversions for each set of interpretations of a given argument. 493 502 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. 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. 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. 497 505 498 506 \subsection{Candidate Set Generation} 499 All the algorithms discussed to this point generate the complete set of candidate argument interpretations before attempting to match the containing function 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 sensewasted work.501 Under the assumption that thatprogrammers 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.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. 502 510 503 511 \subsubsection{Eager} … … 563 571 This comparison closes Baker's open research question, as well as potentially improving Bilson's \CFA compiler. 564 572 565 Rather than testing all of these algorithms in-place in the \CFA compiler, a resolver prototype is being developed whichacts 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.}.573 Rather than testing all of these algorithms in-place in the \CFA compiler, a resolver prototype is being developed that 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.}. 566 574 Multiple variants of this resolver prototype will be implemented, each encapsulating a different expression resolution variant, sharing as much code as feasible. 567 575 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. … … 571 579 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. 572 580 573 This proposed project should provide valuable data on how to implement a performant compiler for modernprogramming languages such as \CFA with powerful static type-systems, specifically targeting the feature interaction between name overloading and implicit conversions.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. 574 582 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. 575 583 -
src/Common/Assert.cc
r04cdd9b re85a8631 10 10 // Created On : Thu Aug 18 13:26:59 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 23:40:29201613 // Update Count : 812 // Last Modified On : Fri Aug 19 17:07:08 2016 13 // Update Count : 10 14 14 // 15 15 16 16 #include <assert.h> 17 #include <cstdarg> 18 #include <cstdio> 19 #include <cstdlib> 17 #include <cstdarg> // varargs 18 #include <cstdio> // fprintf 19 #include <cstdlib> // abort 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 exit( EXIT_FAILURE);28 abort(); 29 29 } 30 30 … … 35 35 va_start( args, fmt ); 36 36 vfprintf( stderr, fmt, args ); 37 exit( EXIT_FAILURE);37 abort(); 38 38 } 39 39 -
src/Common/utility.h
r04cdd9b re85a8631 56 56 } 57 57 58 59 58 template< typename Input_iterator > 60 59 void printEnums( Input_iterator begin, Input_iterator end, const char * const *name_array, std::ostream &os ) { -
src/Makefile.am
r04cdd9b re85a8631 11 11 ## Created On : Sun May 31 08:51:46 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Thu Aug 18 17:47:06201614 ## Update Count : 7 013 ## Last Modified On : Sat Aug 20 11:13:12 2016 14 ## Update Count : 71 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 - I${abs_top_srcdir}/src/include45 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -rdynamic -I${abs_top_srcdir}/src/include 46 46 47 47 MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}} -
src/Makefile.in
r04cdd9b re85a8631 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 - I${abs_top_srcdir}/src/include429 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -rdynamic -I${abs_top_srcdir}/src/include 430 430 all: $(BUILT_SOURCES) 431 431 $(MAKE) $(AM_MAKEFLAGS) all-am -
src/Parser/DeclarationNode.cc
r04cdd9b re85a8631 230 230 DeclarationNode *newnode = new DeclarationNode; 231 231 newnode->name = assign_strptr( name ); 232 newnode->enumeratorValue = constant;232 newnode->enumeratorValue.reset( constant ); 233 233 typedefTable.addToEnclosingScope( newnode->name, TypedefTable::ID ); 234 234 return newnode; … … 776 776 } // if 777 777 } // if 778 delete o; 778 779 return o; 779 780 } -
src/Parser/ExpressionNode.cc
r04cdd9b re85a8631 183 183 184 184 Expression *build_cast( DeclarationNode *decl_node, ExpressionNode *expr_node ) { 185 Type *targetType = decl_node->buildType();185 Type *targetType = maybeMoveBuildType( decl_node ); 186 186 if ( dynamic_cast< VoidType * >( targetType ) ) { 187 187 delete targetType; … … 213 213 } 214 214 Expression *build_sizeOftype( DeclarationNode *decl_node ) { 215 Expression* ret = new SizeofExpr( decl_node->buildType() ); 216 delete decl_node; 217 return ret; 215 return new SizeofExpr( maybeMoveBuildType( decl_node ) ); 218 216 } 219 217 Expression *build_alignOfexpr( ExpressionNode *expr_node ) { … … 221 219 } 222 220 Expression *build_alignOftype( DeclarationNode *decl_node ) { 223 return new AlignofExpr( decl_node->buildType() );221 return new AlignofExpr( maybeMoveBuildType( decl_node) ); 224 222 } 225 223 Expression *build_offsetOf( DeclarationNode *decl_node, NameExpr *member ) { 226 Expression* ret = new UntypedOffsetofExpr( decl_node->buildType(), member->get_name() ); 227 delete decl_node; 224 Expression* ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() ); 228 225 delete member; 229 226 return ret; … … 269 266 } 270 267 Expression *build_attrtype( NameExpr *var, DeclarationNode * decl_node ) { 271 return new AttrExpr( var, decl_node->buildType() );268 return new AttrExpr( var, maybeMoveBuildType( decl_node ) ); 272 269 } 273 270 … … 296 293 } 297 294 Expression *build_typevalue( DeclarationNode *decl ) { 298 return new TypeExpr( decl->buildType() );295 return new TypeExpr( maybeMoveBuildType( decl ) ); 299 296 } 300 297 -
src/Parser/InitializerNode.cc
r04cdd9b re85a8631 45 45 InitializerNode::~InitializerNode() { 46 46 delete expr; 47 delete designator; 48 delete kids; 47 49 } 48 50 -
src/Parser/ParseNode.h
r04cdd9b re85a8631 280 280 LinkageSpec::Spec get_linkage() const { return linkage; } 281 281 DeclarationNode *extractAggregate() const; 282 ExpressionNode *get_enumeratorValue() const { return enumeratorValue; } 282 bool has_enumeratorValue() const { return (bool)enumeratorValue; } 283 ExpressionNode *consume_enumeratorValue() const { return const_cast<DeclarationNode*>(this)->enumeratorValue.release(); } 283 284 284 285 bool get_extension() const { return extension; } … … 295 296 std::list< std::string > attributes; 296 297 ExpressionNode *bitfieldWidth; 297 ExpressionNode *enumeratorValue;298 std::unique_ptr<ExpressionNode> enumeratorValue; 298 299 InitializerNode *initializer; 299 300 bool hasEllipsis; … … 306 307 307 308 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 } 308 315 309 316 //############################################################################## -
src/Parser/StatementNode.cc
r04cdd9b re85a8631 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 = dynamic_cast< StatementNode * >(curr); 57 assert( node ); 56 StatementNode *node = safe_dynamic_cast< StatementNode * >(curr); 58 57 assert( dynamic_cast< CaseStmt * >(node->stmt.get()) ); 59 58 prev = curr; … … 160 159 std::list< Statement * > branches; 161 160 buildMoveList< Statement, StatementNode >( catch_stmt, branches ); 162 CompoundStmt *tryBlock = dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 163 assert( tryBlock ); 161 CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 164 162 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); 165 163 return new TryStmt( noLabels, tryBlock, branches, finallyBlock ); -
src/Parser/TypeData.cc
r04cdd9b re85a8631 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-> get_enumeratorValue() != nullptr) {911 if ( cur->has_enumeratorValue() ) { 912 912 ObjectDecl *member = dynamic_cast< ObjectDecl * >(*members); 913 member->set_init( new SingleInit( maybe Build< Expression >( cur->get_enumeratorValue() ), std::list< Expression * >() ) );913 member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), std::list< Expression * >() ) ); 914 914 } // if 915 915 } // for -
src/Parser/parser.cc
r04cdd9b re85a8631 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 1, 2112, 2116, 2117, 2122, 2128,742 21 29, 2132, 2134, 2135, 2139, 2140, 2141, 2142, 2176, 2178,743 21 79, 2181, 2186, 2191, 2196, 2198, 2200, 2205, 2207, 2209,744 221 1, 2216, 2218, 2227, 2229, 2230, 2235, 2237, 2239, 2244,745 224 6, 2248, 2253, 2255, 2257, 2266, 2267, 2268, 2272, 2274,746 227 6, 2281, 2283, 2285, 2290, 2292, 2294, 2309, 2311, 2312,747 231 4, 2319, 2320, 2325, 2327, 2329, 2334, 2336, 2338, 2340,748 234 5, 2347, 2349, 2359, 2361, 2362, 2364, 2369, 2371, 2373,749 23 78, 2380, 2382, 2384, 2389, 2391, 2393, 2424, 2426, 2427,750 24 29, 2434, 2439, 2447, 2449, 2451, 2456, 2458, 2463, 2465,751 24 79, 2480, 2482, 2487, 2489, 2491, 2493, 2495, 2500, 2501,752 250 3, 2505, 2510, 2512, 2514, 2520, 2522, 2524, 2528, 2530,753 253 2, 2534, 2548, 2549, 2551, 2556, 2558, 2560, 2562, 2564,754 25 69, 2570, 2572, 2574, 2579, 2581, 2583, 2589, 2590, 2592,755 260 1, 2604, 2606, 2609, 2611, 2613, 2626, 2627, 2629, 2634,756 263 6, 2638, 2640, 2642, 2647, 2648, 2650, 2652, 2657, 2659,757 266 7, 2668, 2669, 2674, 2675, 2679, 2681, 2683, 2685, 2687,758 26 89, 2696, 2698, 2700, 2702, 2704, 2706, 2708, 2710, 2712,759 271 4, 2719, 2721, 2723, 2728, 2754, 2755, 2757, 2761, 2762,760 276 6, 2768, 2770, 2772, 2774, 2776, 2783, 2785, 2787, 2789,761 279 1, 2793, 2798, 2803, 2805, 2807, 2825, 2827, 2832, 2833741 2096, 2100, 2104, 2106, 2112, 2113, 2117, 2118, 2123, 2129, 742 2130, 2133, 2135, 2136, 2141, 2142, 2143, 2144, 2178, 2180, 743 2181, 2183, 2188, 2193, 2198, 2200, 2202, 2207, 2209, 2211, 744 2213, 2218, 2220, 2229, 2231, 2232, 2237, 2239, 2241, 2246, 745 2248, 2250, 2255, 2257, 2259, 2268, 2269, 2270, 2274, 2276, 746 2278, 2283, 2285, 2287, 2292, 2294, 2296, 2311, 2313, 2314, 747 2316, 2321, 2322, 2327, 2329, 2331, 2336, 2338, 2340, 2342, 748 2347, 2349, 2351, 2361, 2363, 2364, 2366, 2371, 2373, 2375, 749 2380, 2382, 2384, 2386, 2391, 2393, 2395, 2426, 2428, 2429, 750 2431, 2436, 2441, 2449, 2451, 2453, 2458, 2460, 2465, 2467, 751 2481, 2482, 2484, 2489, 2491, 2493, 2495, 2497, 2502, 2503, 752 2505, 2507, 2512, 2514, 2516, 2522, 2524, 2526, 2530, 2532, 753 2534, 2536, 2550, 2551, 2553, 2558, 2560, 2562, 2564, 2566, 754 2571, 2572, 2574, 2576, 2581, 2583, 2585, 2591, 2592, 2594, 755 2603, 2606, 2608, 2611, 2613, 2615, 2628, 2629, 2631, 2636, 756 2638, 2640, 2642, 2644, 2649, 2650, 2652, 2654, 2659, 2661, 757 2669, 2670, 2671, 2676, 2677, 2681, 2683, 2685, 2687, 2689, 758 2691, 2698, 2700, 2702, 2704, 2706, 2708, 2710, 2712, 2714, 759 2716, 2721, 2723, 2725, 2730, 2756, 2757, 2759, 2763, 2764, 760 2768, 2770, 2772, 2774, 2776, 2778, 2785, 2787, 2789, 2791, 761 2793, 2795, 2800, 2805, 2807, 2809, 2827, 2829, 2834, 2835 762 762 }; 763 763 #endif … … 7075 7075 break; 7076 7076 7077 case 543: 7078 #line 2107 "parser.yy" /* yacc.c:1646 */ 7079 { delete (yyvsp[-2].constant); } 7080 #line 7081 "Parser/parser.cc" /* yacc.c:1646 */ 7081 break; 7082 7077 7083 case 544: 7078 #line 211 1"parser.yy" /* yacc.c:1646 */7084 #line 2112 "parser.yy" /* yacc.c:1646 */ 7079 7085 { (yyval.decl) = 0; } 7080 #line 708 1"Parser/parser.cc" /* yacc.c:1646 */7086 #line 7087 "Parser/parser.cc" /* yacc.c:1646 */ 7081 7087 break; 7082 7088 7083 7089 case 547: 7084 #line 211 8"parser.yy" /* yacc.c:1646 */7090 #line 2119 "parser.yy" /* yacc.c:1646 */ 7085 7091 { (yyval.decl) = (yyvsp[0].decl)->addQualifiers( (yyvsp[-1].decl) ); } 7086 #line 70 87"Parser/parser.cc" /* yacc.c:1646 */7092 #line 7093 "Parser/parser.cc" /* yacc.c:1646 */ 7087 7093 break; 7088 7094 7089 7095 case 548: 7090 #line 212 4"parser.yy" /* yacc.c:1646 */7096 #line 2125 "parser.yy" /* yacc.c:1646 */ 7091 7097 { (yyval.decl) = 0; } 7092 #line 7093 "Parser/parser.cc" /* yacc.c:1646 */ 7098 #line 7099 "Parser/parser.cc" /* yacc.c:1646 */ 7099 break; 7100 7101 case 553: 7102 #line 2137 "parser.yy" /* yacc.c:1646 */ 7103 { delete (yyvsp[-1].en); } 7104 #line 7105 "Parser/parser.cc" /* yacc.c:1646 */ 7093 7105 break; 7094 7106 7095 7107 case 554: 7096 #line 21 39"parser.yy" /* yacc.c:1646 */7097 { }7098 #line 7 099"Parser/parser.cc" /* yacc.c:1646 */7108 #line 2141 "parser.yy" /* yacc.c:1646 */ 7109 { delete (yyvsp[0].tok); } 7110 #line 7111 "Parser/parser.cc" /* yacc.c:1646 */ 7099 7111 break; 7100 7112 7101 7113 case 555: 7102 #line 214 0"parser.yy" /* yacc.c:1646 */7103 { }7104 #line 71 05"Parser/parser.cc" /* yacc.c:1646 */7114 #line 2142 "parser.yy" /* yacc.c:1646 */ 7115 { delete (yyvsp[0].decl); } 7116 #line 7117 "Parser/parser.cc" /* yacc.c:1646 */ 7105 7117 break; 7106 7118 7107 7119 case 556: 7108 #line 214 1"parser.yy" /* yacc.c:1646 */7109 { }7110 #line 71 11"Parser/parser.cc" /* yacc.c:1646 */7120 #line 2143 "parser.yy" /* yacc.c:1646 */ 7121 { delete (yyvsp[0].decl); } 7122 #line 7123 "Parser/parser.cc" /* yacc.c:1646 */ 7111 7123 break; 7112 7124 7113 7125 case 557: 7114 #line 214 2"parser.yy" /* yacc.c:1646 */7115 { }7116 #line 71 17"Parser/parser.cc" /* yacc.c:1646 */7126 #line 2144 "parser.yy" /* yacc.c:1646 */ 7127 { delete (yyvsp[0].decl); } 7128 #line 7129 "Parser/parser.cc" /* yacc.c:1646 */ 7117 7129 break; 7118 7130 7119 7131 case 558: 7120 #line 217 7"parser.yy" /* yacc.c:1646 */7132 #line 2179 "parser.yy" /* yacc.c:1646 */ 7121 7133 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7122 #line 71 23"Parser/parser.cc" /* yacc.c:1646 */7134 #line 7135 "Parser/parser.cc" /* yacc.c:1646 */ 7123 7135 break; 7124 7136 7125 7137 case 560: 7126 #line 2180 "parser.yy" /* yacc.c:1646 */7127 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7128 #line 7129 "Parser/parser.cc" /* yacc.c:1646 */7129 break;7130 7131 case 561:7132 7138 #line 2182 "parser.yy" /* yacc.c:1646 */ 7133 7139 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7134 #line 7135 "Parser/parser.cc" /* yacc.c:1646 */ 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 */ 7135 7147 break; 7136 7148 7137 7149 case 562: 7138 #line 218 7"parser.yy" /* yacc.c:1646 */7150 #line 2189 "parser.yy" /* yacc.c:1646 */ 7139 7151 { 7140 7152 typedefTable.setNextIdentifier( *(yyvsp[0].tok) ); 7141 7153 (yyval.decl) = DeclarationNode::newName( (yyvsp[0].tok) ); 7142 7154 } 7143 #line 71 44"Parser/parser.cc" /* yacc.c:1646 */7155 #line 7156 "Parser/parser.cc" /* yacc.c:1646 */ 7144 7156 break; 7145 7157 7146 7158 case 563: 7147 #line 219 2"parser.yy" /* yacc.c:1646 */7159 #line 2194 "parser.yy" /* yacc.c:1646 */ 7148 7160 { (yyval.decl) = (yyvsp[-1].decl); } 7149 #line 71 50"Parser/parser.cc" /* yacc.c:1646 */7161 #line 7162 "Parser/parser.cc" /* yacc.c:1646 */ 7150 7162 break; 7151 7163 7152 7164 case 564: 7153 #line 219 7"parser.yy" /* yacc.c:1646 */7165 #line 2199 "parser.yy" /* yacc.c:1646 */ 7154 7166 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7155 #line 71 56"Parser/parser.cc" /* yacc.c:1646 */7167 #line 7168 "Parser/parser.cc" /* yacc.c:1646 */ 7156 7168 break; 7157 7169 7158 7170 case 565: 7159 #line 2 199"parser.yy" /* yacc.c:1646 */7171 #line 2201 "parser.yy" /* yacc.c:1646 */ 7160 7172 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7161 #line 71 62"Parser/parser.cc" /* yacc.c:1646 */7173 #line 7174 "Parser/parser.cc" /* yacc.c:1646 */ 7162 7174 break; 7163 7175 7164 7176 case 566: 7165 #line 220 1"parser.yy" /* yacc.c:1646 */7177 #line 2203 "parser.yy" /* yacc.c:1646 */ 7166 7178 { (yyval.decl) = (yyvsp[-1].decl); } 7167 #line 71 68"Parser/parser.cc" /* yacc.c:1646 */7179 #line 7180 "Parser/parser.cc" /* yacc.c:1646 */ 7168 7180 break; 7169 7181 7170 7182 case 567: 7171 #line 220 6"parser.yy" /* yacc.c:1646 */7183 #line 2208 "parser.yy" /* yacc.c:1646 */ 7172 7184 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7173 #line 71 74"Parser/parser.cc" /* yacc.c:1646 */7185 #line 7186 "Parser/parser.cc" /* yacc.c:1646 */ 7174 7186 break; 7175 7187 7176 7188 case 568: 7177 #line 2208 "parser.yy" /* yacc.c:1646 */7178 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7179 #line 7180 "Parser/parser.cc" /* yacc.c:1646 */7180 break;7181 7182 case 569:7183 7189 #line 2210 "parser.yy" /* yacc.c:1646 */ 7184 7190 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7185 #line 7186 "Parser/parser.cc" /* yacc.c:1646 */ 7191 #line 7192 "Parser/parser.cc" /* yacc.c:1646 */ 7192 break; 7193 7194 case 569: 7195 #line 2212 "parser.yy" /* yacc.c:1646 */ 7196 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7197 #line 7198 "Parser/parser.cc" /* yacc.c:1646 */ 7186 7198 break; 7187 7199 7188 7200 case 570: 7189 #line 2212 "parser.yy" /* yacc.c:1646 */ 7190 { (yyval.decl) = (yyvsp[-1].decl); } 7191 #line 7192 "Parser/parser.cc" /* yacc.c:1646 */ 7192 break; 7193 7194 case 571: 7195 #line 2217 "parser.yy" /* yacc.c:1646 */ 7196 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7197 #line 7198 "Parser/parser.cc" /* yacc.c:1646 */ 7198 break; 7199 7200 case 572: 7201 #line 2219 "parser.yy" /* yacc.c:1646 */ 7201 #line 2214 "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 */ 7208 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7209 #line 7210 "Parser/parser.cc" /* yacc.c:1646 */ 7210 break; 7211 7212 case 572: 7213 #line 2221 "parser.yy" /* yacc.c:1646 */ 7214 { (yyval.decl) = (yyvsp[-1].decl); } 7215 #line 7216 "Parser/parser.cc" /* yacc.c:1646 */ 7216 break; 7217 7206 7218 case 573: 7207 #line 22 28"parser.yy" /* yacc.c:1646 */7219 #line 2230 "parser.yy" /* yacc.c:1646 */ 7208 7220 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7209 #line 72 10"Parser/parser.cc" /* yacc.c:1646 */7221 #line 7222 "Parser/parser.cc" /* yacc.c:1646 */ 7210 7222 break; 7211 7223 7212 7224 case 575: 7213 #line 223 1"parser.yy" /* yacc.c:1646 */7225 #line 2233 "parser.yy" /* yacc.c:1646 */ 7214 7226 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7215 #line 72 16"Parser/parser.cc" /* yacc.c:1646 */7227 #line 7228 "Parser/parser.cc" /* yacc.c:1646 */ 7216 7228 break; 7217 7229 7218 7230 case 576: 7219 #line 223 6"parser.yy" /* yacc.c:1646 */7231 #line 2238 "parser.yy" /* yacc.c:1646 */ 7220 7232 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7221 #line 72 22"Parser/parser.cc" /* yacc.c:1646 */7233 #line 7234 "Parser/parser.cc" /* yacc.c:1646 */ 7222 7234 break; 7223 7235 7224 7236 case 577: 7225 #line 22 38"parser.yy" /* yacc.c:1646 */7237 #line 2240 "parser.yy" /* yacc.c:1646 */ 7226 7238 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7227 #line 72 28"Parser/parser.cc" /* yacc.c:1646 */7239 #line 7240 "Parser/parser.cc" /* yacc.c:1646 */ 7228 7240 break; 7229 7241 7230 7242 case 578: 7231 #line 224 0"parser.yy" /* yacc.c:1646 */7243 #line 2242 "parser.yy" /* yacc.c:1646 */ 7232 7244 { (yyval.decl) = (yyvsp[-1].decl); } 7233 #line 72 34"Parser/parser.cc" /* yacc.c:1646 */7245 #line 7246 "Parser/parser.cc" /* yacc.c:1646 */ 7234 7246 break; 7235 7247 7236 7248 case 579: 7237 #line 224 5"parser.yy" /* yacc.c:1646 */7249 #line 2247 "parser.yy" /* yacc.c:1646 */ 7238 7250 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7239 #line 72 40"Parser/parser.cc" /* yacc.c:1646 */7251 #line 7252 "Parser/parser.cc" /* yacc.c:1646 */ 7240 7252 break; 7241 7253 7242 7254 case 580: 7243 #line 224 7"parser.yy" /* yacc.c:1646 */7255 #line 2249 "parser.yy" /* yacc.c:1646 */ 7244 7256 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7245 #line 72 46"Parser/parser.cc" /* yacc.c:1646 */7257 #line 7258 "Parser/parser.cc" /* yacc.c:1646 */ 7246 7258 break; 7247 7259 7248 7260 case 581: 7249 #line 22 49"parser.yy" /* yacc.c:1646 */7261 #line 2251 "parser.yy" /* yacc.c:1646 */ 7250 7262 { (yyval.decl) = (yyvsp[-1].decl); } 7251 #line 72 52"Parser/parser.cc" /* yacc.c:1646 */7263 #line 7264 "Parser/parser.cc" /* yacc.c:1646 */ 7252 7264 break; 7253 7265 7254 7266 case 582: 7255 #line 2254 "parser.yy" /* yacc.c:1646 */7256 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7257 #line 7258 "Parser/parser.cc" /* yacc.c:1646 */7258 break;7259 7260 case 583:7261 7267 #line 2256 "parser.yy" /* yacc.c:1646 */ 7262 7268 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7263 #line 7264 "Parser/parser.cc" /* yacc.c:1646 */ 7269 #line 7270 "Parser/parser.cc" /* yacc.c:1646 */ 7270 break; 7271 7272 case 583: 7273 #line 2258 "parser.yy" /* yacc.c:1646 */ 7274 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7275 #line 7276 "Parser/parser.cc" /* yacc.c:1646 */ 7264 7276 break; 7265 7277 7266 7278 case 584: 7267 #line 22 58"parser.yy" /* yacc.c:1646 */7279 #line 2260 "parser.yy" /* yacc.c:1646 */ 7268 7280 { (yyval.decl) = (yyvsp[-1].decl); } 7269 #line 72 70"Parser/parser.cc" /* yacc.c:1646 */7281 #line 7282 "Parser/parser.cc" /* yacc.c:1646 */ 7270 7282 break; 7271 7283 7272 7284 case 588: 7273 #line 227 3"parser.yy" /* yacc.c:1646 */7285 #line 2275 "parser.yy" /* yacc.c:1646 */ 7274 7286 { (yyval.decl) = (yyvsp[-3].decl)->addIdList( (yyvsp[-1].decl) ); } 7275 #line 72 76"Parser/parser.cc" /* yacc.c:1646 */7287 #line 7288 "Parser/parser.cc" /* yacc.c:1646 */ 7276 7288 break; 7277 7289 7278 7290 case 589: 7279 #line 227 5"parser.yy" /* yacc.c:1646 */7291 #line 2277 "parser.yy" /* yacc.c:1646 */ 7280 7292 { (yyval.decl) = (yyvsp[-4].decl)->addIdList( (yyvsp[-1].decl) ); } 7281 #line 72 82"Parser/parser.cc" /* yacc.c:1646 */7293 #line 7294 "Parser/parser.cc" /* yacc.c:1646 */ 7282 7294 break; 7283 7295 7284 7296 case 590: 7285 #line 227 7"parser.yy" /* yacc.c:1646 */7297 #line 2279 "parser.yy" /* yacc.c:1646 */ 7286 7298 { (yyval.decl) = (yyvsp[-1].decl); } 7287 #line 7 288"Parser/parser.cc" /* yacc.c:1646 */7299 #line 7300 "Parser/parser.cc" /* yacc.c:1646 */ 7288 7300 break; 7289 7301 7290 7302 case 591: 7291 #line 228 2"parser.yy" /* yacc.c:1646 */7303 #line 2284 "parser.yy" /* yacc.c:1646 */ 7292 7304 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7293 #line 7 294"Parser/parser.cc" /* yacc.c:1646 */7305 #line 7306 "Parser/parser.cc" /* yacc.c:1646 */ 7294 7306 break; 7295 7307 7296 7308 case 592: 7297 #line 228 4"parser.yy" /* yacc.c:1646 */7309 #line 2286 "parser.yy" /* yacc.c:1646 */ 7298 7310 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7299 #line 73 00"Parser/parser.cc" /* yacc.c:1646 */7311 #line 7312 "Parser/parser.cc" /* yacc.c:1646 */ 7300 7312 break; 7301 7313 7302 7314 case 593: 7303 #line 228 6"parser.yy" /* yacc.c:1646 */7315 #line 2288 "parser.yy" /* yacc.c:1646 */ 7304 7316 { (yyval.decl) = (yyvsp[-1].decl); } 7305 #line 73 06"Parser/parser.cc" /* yacc.c:1646 */7317 #line 7318 "Parser/parser.cc" /* yacc.c:1646 */ 7306 7318 break; 7307 7319 7308 7320 case 594: 7309 #line 2291 "parser.yy" /* yacc.c:1646 */7310 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7311 #line 7312 "Parser/parser.cc" /* yacc.c:1646 */7312 break;7313 7314 case 595:7315 7321 #line 2293 "parser.yy" /* yacc.c:1646 */ 7316 7322 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7317 #line 7318 "Parser/parser.cc" /* yacc.c:1646 */ 7323 #line 7324 "Parser/parser.cc" /* yacc.c:1646 */ 7324 break; 7325 7326 case 595: 7327 #line 2295 "parser.yy" /* yacc.c:1646 */ 7328 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7329 #line 7330 "Parser/parser.cc" /* yacc.c:1646 */ 7318 7330 break; 7319 7331 7320 7332 case 596: 7321 #line 229 5"parser.yy" /* yacc.c:1646 */7333 #line 2297 "parser.yy" /* yacc.c:1646 */ 7322 7334 { (yyval.decl) = (yyvsp[-1].decl); } 7323 #line 73 24"Parser/parser.cc" /* yacc.c:1646 */7335 #line 7336 "Parser/parser.cc" /* yacc.c:1646 */ 7324 7336 break; 7325 7337 7326 7338 case 597: 7327 #line 231 0"parser.yy" /* yacc.c:1646 */7339 #line 2312 "parser.yy" /* yacc.c:1646 */ 7328 7340 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7329 #line 73 30"Parser/parser.cc" /* yacc.c:1646 */7341 #line 7342 "Parser/parser.cc" /* yacc.c:1646 */ 7330 7342 break; 7331 7343 7332 7344 case 599: 7333 #line 2313 "parser.yy" /* yacc.c:1646 */7334 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7335 #line 7336 "Parser/parser.cc" /* yacc.c:1646 */7336 break;7337 7338 case 600:7339 7345 #line 2315 "parser.yy" /* yacc.c:1646 */ 7340 7346 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7341 #line 7342 "Parser/parser.cc" /* yacc.c:1646 */ 7347 #line 7348 "Parser/parser.cc" /* yacc.c:1646 */ 7348 break; 7349 7350 case 600: 7351 #line 2317 "parser.yy" /* yacc.c:1646 */ 7352 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7353 #line 7354 "Parser/parser.cc" /* yacc.c:1646 */ 7342 7354 break; 7343 7355 7344 7356 case 602: 7345 #line 232 1"parser.yy" /* yacc.c:1646 */7357 #line 2323 "parser.yy" /* yacc.c:1646 */ 7346 7358 { (yyval.decl) = (yyvsp[-1].decl); } 7347 #line 73 48"Parser/parser.cc" /* yacc.c:1646 */7359 #line 7360 "Parser/parser.cc" /* yacc.c:1646 */ 7348 7360 break; 7349 7361 7350 7362 case 603: 7351 #line 232 6"parser.yy" /* yacc.c:1646 */7363 #line 2328 "parser.yy" /* yacc.c:1646 */ 7352 7364 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7353 #line 73 54"Parser/parser.cc" /* yacc.c:1646 */7365 #line 7366 "Parser/parser.cc" /* yacc.c:1646 */ 7354 7366 break; 7355 7367 7356 7368 case 604: 7357 #line 23 28"parser.yy" /* yacc.c:1646 */7369 #line 2330 "parser.yy" /* yacc.c:1646 */ 7358 7370 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7359 #line 73 60"Parser/parser.cc" /* yacc.c:1646 */7371 #line 7372 "Parser/parser.cc" /* yacc.c:1646 */ 7360 7372 break; 7361 7373 7362 7374 case 605: 7363 #line 233 0"parser.yy" /* yacc.c:1646 */7375 #line 2332 "parser.yy" /* yacc.c:1646 */ 7364 7376 { (yyval.decl) = (yyvsp[-1].decl); } 7365 #line 73 66"Parser/parser.cc" /* yacc.c:1646 */7377 #line 7378 "Parser/parser.cc" /* yacc.c:1646 */ 7366 7378 break; 7367 7379 7368 7380 case 606: 7369 #line 233 5"parser.yy" /* yacc.c:1646 */7381 #line 2337 "parser.yy" /* yacc.c:1646 */ 7370 7382 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7371 #line 73 72"Parser/parser.cc" /* yacc.c:1646 */7383 #line 7384 "Parser/parser.cc" /* yacc.c:1646 */ 7372 7384 break; 7373 7385 7374 7386 case 607: 7375 #line 2337 "parser.yy" /* yacc.c:1646 */7376 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7377 #line 7378 "Parser/parser.cc" /* yacc.c:1646 */7378 break;7379 7380 case 608:7381 7387 #line 2339 "parser.yy" /* yacc.c:1646 */ 7382 7388 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7383 #line 7384 "Parser/parser.cc" /* yacc.c:1646 */ 7389 #line 7390 "Parser/parser.cc" /* yacc.c:1646 */ 7390 break; 7391 7392 case 608: 7393 #line 2341 "parser.yy" /* yacc.c:1646 */ 7394 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7395 #line 7396 "Parser/parser.cc" /* yacc.c:1646 */ 7384 7396 break; 7385 7397 7386 7398 case 609: 7387 #line 234 1"parser.yy" /* yacc.c:1646 */7399 #line 2343 "parser.yy" /* yacc.c:1646 */ 7388 7400 { (yyval.decl) = (yyvsp[-1].decl); } 7389 #line 7 390"Parser/parser.cc" /* yacc.c:1646 */7401 #line 7402 "Parser/parser.cc" /* yacc.c:1646 */ 7390 7402 break; 7391 7403 7392 7404 case 610: 7393 #line 234 6"parser.yy" /* yacc.c:1646 */7405 #line 2348 "parser.yy" /* yacc.c:1646 */ 7394 7406 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7395 #line 7 396"Parser/parser.cc" /* yacc.c:1646 */7407 #line 7408 "Parser/parser.cc" /* yacc.c:1646 */ 7396 7408 break; 7397 7409 7398 7410 case 611: 7399 #line 23 48"parser.yy" /* yacc.c:1646 */7411 #line 2350 "parser.yy" /* yacc.c:1646 */ 7400 7412 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7401 #line 74 02"Parser/parser.cc" /* yacc.c:1646 */7413 #line 7414 "Parser/parser.cc" /* yacc.c:1646 */ 7402 7414 break; 7403 7415 7404 7416 case 612: 7405 #line 235 0"parser.yy" /* yacc.c:1646 */7417 #line 2352 "parser.yy" /* yacc.c:1646 */ 7406 7418 { (yyval.decl) = (yyvsp[-1].decl); } 7407 #line 74 08"Parser/parser.cc" /* yacc.c:1646 */7419 #line 7420 "Parser/parser.cc" /* yacc.c:1646 */ 7408 7420 break; 7409 7421 7410 7422 case 613: 7411 #line 236 0"parser.yy" /* yacc.c:1646 */7423 #line 2362 "parser.yy" /* yacc.c:1646 */ 7412 7424 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7413 #line 74 14"Parser/parser.cc" /* yacc.c:1646 */7425 #line 7426 "Parser/parser.cc" /* yacc.c:1646 */ 7414 7426 break; 7415 7427 7416 7428 case 615: 7417 #line 2363 "parser.yy" /* yacc.c:1646 */7418 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7419 #line 7420 "Parser/parser.cc" /* yacc.c:1646 */7420 break;7421 7422 case 616:7423 7429 #line 2365 "parser.yy" /* yacc.c:1646 */ 7424 7430 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7425 #line 7426 "Parser/parser.cc" /* yacc.c:1646 */ 7431 #line 7432 "Parser/parser.cc" /* yacc.c:1646 */ 7432 break; 7433 7434 case 616: 7435 #line 2367 "parser.yy" /* yacc.c:1646 */ 7436 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7437 #line 7438 "Parser/parser.cc" /* yacc.c:1646 */ 7426 7438 break; 7427 7439 7428 7440 case 617: 7429 #line 237 0"parser.yy" /* yacc.c:1646 */7441 #line 2372 "parser.yy" /* yacc.c:1646 */ 7430 7442 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7431 #line 74 32"Parser/parser.cc" /* yacc.c:1646 */7443 #line 7444 "Parser/parser.cc" /* yacc.c:1646 */ 7432 7444 break; 7433 7445 7434 7446 case 618: 7435 #line 237 2"parser.yy" /* yacc.c:1646 */7447 #line 2374 "parser.yy" /* yacc.c:1646 */ 7436 7448 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7437 #line 74 38"Parser/parser.cc" /* yacc.c:1646 */7449 #line 7450 "Parser/parser.cc" /* yacc.c:1646 */ 7438 7450 break; 7439 7451 7440 7452 case 619: 7441 #line 237 4"parser.yy" /* yacc.c:1646 */7453 #line 2376 "parser.yy" /* yacc.c:1646 */ 7442 7454 { (yyval.decl) = (yyvsp[-1].decl); } 7443 #line 74 44"Parser/parser.cc" /* yacc.c:1646 */7455 #line 7456 "Parser/parser.cc" /* yacc.c:1646 */ 7444 7456 break; 7445 7457 7446 7458 case 620: 7447 #line 23 79"parser.yy" /* yacc.c:1646 */7459 #line 2381 "parser.yy" /* yacc.c:1646 */ 7448 7460 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7449 #line 74 50"Parser/parser.cc" /* yacc.c:1646 */7461 #line 7462 "Parser/parser.cc" /* yacc.c:1646 */ 7450 7462 break; 7451 7463 7452 7464 case 621: 7453 #line 2381 "parser.yy" /* yacc.c:1646 */7454 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7455 #line 7456 "Parser/parser.cc" /* yacc.c:1646 */7456 break;7457 7458 case 622:7459 7465 #line 2383 "parser.yy" /* yacc.c:1646 */ 7460 7466 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7461 #line 7462 "Parser/parser.cc" /* yacc.c:1646 */ 7467 #line 7468 "Parser/parser.cc" /* yacc.c:1646 */ 7468 break; 7469 7470 case 622: 7471 #line 2385 "parser.yy" /* yacc.c:1646 */ 7472 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7473 #line 7474 "Parser/parser.cc" /* yacc.c:1646 */ 7462 7474 break; 7463 7475 7464 7476 case 623: 7465 #line 238 5"parser.yy" /* yacc.c:1646 */7477 #line 2387 "parser.yy" /* yacc.c:1646 */ 7466 7478 { (yyval.decl) = (yyvsp[-1].decl); } 7467 #line 74 68"Parser/parser.cc" /* yacc.c:1646 */7479 #line 7480 "Parser/parser.cc" /* yacc.c:1646 */ 7468 7480 break; 7469 7481 7470 7482 case 624: 7471 #line 239 0"parser.yy" /* yacc.c:1646 */7483 #line 2392 "parser.yy" /* yacc.c:1646 */ 7472 7484 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7473 #line 74 74"Parser/parser.cc" /* yacc.c:1646 */7485 #line 7486 "Parser/parser.cc" /* yacc.c:1646 */ 7474 7486 break; 7475 7487 7476 7488 case 625: 7477 #line 239 2"parser.yy" /* yacc.c:1646 */7489 #line 2394 "parser.yy" /* yacc.c:1646 */ 7478 7490 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7479 #line 74 80"Parser/parser.cc" /* yacc.c:1646 */7491 #line 7492 "Parser/parser.cc" /* yacc.c:1646 */ 7480 7492 break; 7481 7493 7482 7494 case 626: 7483 #line 239 4"parser.yy" /* yacc.c:1646 */7495 #line 2396 "parser.yy" /* yacc.c:1646 */ 7484 7496 { (yyval.decl) = (yyvsp[-1].decl); } 7485 #line 74 86"Parser/parser.cc" /* yacc.c:1646 */7497 #line 7498 "Parser/parser.cc" /* yacc.c:1646 */ 7486 7498 break; 7487 7499 7488 7500 case 627: 7489 #line 242 5"parser.yy" /* yacc.c:1646 */7501 #line 2427 "parser.yy" /* yacc.c:1646 */ 7490 7502 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7491 #line 7 492"Parser/parser.cc" /* yacc.c:1646 */7503 #line 7504 "Parser/parser.cc" /* yacc.c:1646 */ 7492 7504 break; 7493 7505 7494 7506 case 629: 7495 #line 2428 "parser.yy" /* yacc.c:1646 */7496 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7497 #line 7498 "Parser/parser.cc" /* yacc.c:1646 */7498 break;7499 7500 case 630:7501 7507 #line 2430 "parser.yy" /* yacc.c:1646 */ 7502 7508 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7503 #line 7504 "Parser/parser.cc" /* yacc.c:1646 */ 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 */ 7504 7516 break; 7505 7517 7506 7518 case 631: 7507 #line 243 5"parser.yy" /* yacc.c:1646 */7519 #line 2437 "parser.yy" /* yacc.c:1646 */ 7508 7520 { 7509 7521 typedefTable.setNextIdentifier( *(yyvsp[0].tok) ); 7510 7522 (yyval.decl) = DeclarationNode::newName( (yyvsp[0].tok) ); 7511 7523 } 7512 #line 75 13"Parser/parser.cc" /* yacc.c:1646 */7524 #line 7525 "Parser/parser.cc" /* yacc.c:1646 */ 7513 7525 break; 7514 7526 7515 7527 case 632: 7516 #line 244 0"parser.yy" /* yacc.c:1646 */7528 #line 2442 "parser.yy" /* yacc.c:1646 */ 7517 7529 { 7518 7530 typedefTable.setNextIdentifier( *(yyvsp[0].tok) ); 7519 7531 (yyval.decl) = DeclarationNode::newName( (yyvsp[0].tok) ); 7520 7532 } 7521 #line 75 22"Parser/parser.cc" /* yacc.c:1646 */7533 #line 7534 "Parser/parser.cc" /* yacc.c:1646 */ 7522 7534 break; 7523 7535 7524 7536 case 633: 7525 #line 24 48"parser.yy" /* yacc.c:1646 */7537 #line 2450 "parser.yy" /* yacc.c:1646 */ 7526 7538 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7527 #line 75 28"Parser/parser.cc" /* yacc.c:1646 */7539 #line 7540 "Parser/parser.cc" /* yacc.c:1646 */ 7528 7540 break; 7529 7541 7530 7542 case 634: 7531 #line 245 0"parser.yy" /* yacc.c:1646 */7543 #line 2452 "parser.yy" /* yacc.c:1646 */ 7532 7544 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7533 #line 75 34"Parser/parser.cc" /* yacc.c:1646 */7545 #line 7546 "Parser/parser.cc" /* yacc.c:1646 */ 7534 7546 break; 7535 7547 7536 7548 case 635: 7537 #line 245 2"parser.yy" /* yacc.c:1646 */7549 #line 2454 "parser.yy" /* yacc.c:1646 */ 7538 7550 { (yyval.decl) = (yyvsp[-1].decl); } 7539 #line 75 40"Parser/parser.cc" /* yacc.c:1646 */7551 #line 7552 "Parser/parser.cc" /* yacc.c:1646 */ 7540 7552 break; 7541 7553 7542 7554 case 636: 7543 #line 245 7"parser.yy" /* yacc.c:1646 */7555 #line 2459 "parser.yy" /* yacc.c:1646 */ 7544 7556 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7545 #line 75 46"Parser/parser.cc" /* yacc.c:1646 */7557 #line 7558 "Parser/parser.cc" /* yacc.c:1646 */ 7546 7558 break; 7547 7559 7548 7560 case 637: 7549 #line 24 59"parser.yy" /* yacc.c:1646 */7561 #line 2461 "parser.yy" /* yacc.c:1646 */ 7550 7562 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7551 #line 75 52"Parser/parser.cc" /* yacc.c:1646 */7563 #line 7564 "Parser/parser.cc" /* yacc.c:1646 */ 7552 7564 break; 7553 7565 7554 7566 case 638: 7555 #line 246 4"parser.yy" /* yacc.c:1646 */7567 #line 2466 "parser.yy" /* yacc.c:1646 */ 7556 7568 { (yyval.decl) = (yyvsp[-5].decl)->addParamList( (yyvsp[-2].decl) ); } 7557 #line 75 58"Parser/parser.cc" /* yacc.c:1646 */7569 #line 7570 "Parser/parser.cc" /* yacc.c:1646 */ 7558 7570 break; 7559 7571 7560 7572 case 639: 7561 #line 246 6"parser.yy" /* yacc.c:1646 */7573 #line 2468 "parser.yy" /* yacc.c:1646 */ 7562 7574 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7563 #line 75 64"Parser/parser.cc" /* yacc.c:1646 */7575 #line 7576 "Parser/parser.cc" /* yacc.c:1646 */ 7564 7576 break; 7565 7577 7566 7578 case 641: 7567 #line 2481 "parser.yy" /* yacc.c:1646 */7568 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7569 #line 7570 "Parser/parser.cc" /* yacc.c:1646 */7570 break;7571 7572 case 642:7573 7579 #line 2483 "parser.yy" /* yacc.c:1646 */ 7574 7580 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7575 #line 7576 "Parser/parser.cc" /* yacc.c:1646 */ 7581 #line 7582 "Parser/parser.cc" /* yacc.c:1646 */ 7582 break; 7583 7584 case 642: 7585 #line 2485 "parser.yy" /* yacc.c:1646 */ 7586 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7587 #line 7588 "Parser/parser.cc" /* yacc.c:1646 */ 7576 7588 break; 7577 7589 7578 7590 case 643: 7579 #line 24 88"parser.yy" /* yacc.c:1646 */7591 #line 2490 "parser.yy" /* yacc.c:1646 */ 7580 7592 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 7581 #line 75 82"Parser/parser.cc" /* yacc.c:1646 */7593 #line 7594 "Parser/parser.cc" /* yacc.c:1646 */ 7582 7594 break; 7583 7595 7584 7596 case 644: 7585 #line 249 0"parser.yy" /* yacc.c:1646 */7597 #line 2492 "parser.yy" /* yacc.c:1646 */ 7586 7598 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); } 7587 #line 7 588"Parser/parser.cc" /* yacc.c:1646 */7599 #line 7600 "Parser/parser.cc" /* yacc.c:1646 */ 7588 7600 break; 7589 7601 7590 7602 case 645: 7591 #line 249 2"parser.yy" /* yacc.c:1646 */7603 #line 2494 "parser.yy" /* yacc.c:1646 */ 7592 7604 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7593 #line 7 594"Parser/parser.cc" /* yacc.c:1646 */7605 #line 7606 "Parser/parser.cc" /* yacc.c:1646 */ 7594 7606 break; 7595 7607 7596 7608 case 646: 7597 #line 249 4"parser.yy" /* yacc.c:1646 */7609 #line 2496 "parser.yy" /* yacc.c:1646 */ 7598 7610 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7599 #line 76 00"Parser/parser.cc" /* yacc.c:1646 */7611 #line 7612 "Parser/parser.cc" /* yacc.c:1646 */ 7600 7612 break; 7601 7613 7602 7614 case 647: 7603 #line 249 6"parser.yy" /* yacc.c:1646 */7615 #line 2498 "parser.yy" /* yacc.c:1646 */ 7604 7616 { (yyval.decl) = (yyvsp[-1].decl); } 7605 #line 76 06"Parser/parser.cc" /* yacc.c:1646 */7617 #line 7618 "Parser/parser.cc" /* yacc.c:1646 */ 7606 7618 break; 7607 7619 7608 7620 case 649: 7609 #line 2502 "parser.yy" /* yacc.c:1646 */7610 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7611 #line 7612 "Parser/parser.cc" /* yacc.c:1646 */7612 break;7613 7614 case 650:7615 7621 #line 2504 "parser.yy" /* yacc.c:1646 */ 7616 7622 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7617 #line 7618 "Parser/parser.cc" /* yacc.c:1646 */ 7623 #line 7624 "Parser/parser.cc" /* yacc.c:1646 */ 7624 break; 7625 7626 case 650: 7627 #line 2506 "parser.yy" /* yacc.c:1646 */ 7628 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7629 #line 7630 "Parser/parser.cc" /* yacc.c:1646 */ 7618 7630 break; 7619 7631 7620 7632 case 651: 7621 #line 250 6"parser.yy" /* yacc.c:1646 */7633 #line 2508 "parser.yy" /* yacc.c:1646 */ 7622 7634 { (yyval.decl) = (yyvsp[-1].decl); } 7623 #line 76 24"Parser/parser.cc" /* yacc.c:1646 */7635 #line 7636 "Parser/parser.cc" /* yacc.c:1646 */ 7624 7636 break; 7625 7637 7626 7638 case 652: 7627 #line 251 1"parser.yy" /* yacc.c:1646 */7639 #line 2513 "parser.yy" /* yacc.c:1646 */ 7628 7640 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[-2].decl), 0 ); } 7629 #line 76 30"Parser/parser.cc" /* yacc.c:1646 */7641 #line 7642 "Parser/parser.cc" /* yacc.c:1646 */ 7630 7642 break; 7631 7643 7632 7644 case 653: 7633 #line 251 3"parser.yy" /* yacc.c:1646 */7645 #line 2515 "parser.yy" /* yacc.c:1646 */ 7634 7646 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7635 #line 76 36"Parser/parser.cc" /* yacc.c:1646 */7647 #line 7648 "Parser/parser.cc" /* yacc.c:1646 */ 7636 7648 break; 7637 7649 7638 7650 case 654: 7639 #line 251 5"parser.yy" /* yacc.c:1646 */7651 #line 2517 "parser.yy" /* yacc.c:1646 */ 7640 7652 { (yyval.decl) = (yyvsp[-1].decl); } 7641 #line 76 42"Parser/parser.cc" /* yacc.c:1646 */7653 #line 7654 "Parser/parser.cc" /* yacc.c:1646 */ 7642 7654 break; 7643 7655 7644 7656 case 655: 7645 #line 252 1"parser.yy" /* yacc.c:1646 */7657 #line 2523 "parser.yy" /* yacc.c:1646 */ 7646 7658 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 7647 #line 76 48"Parser/parser.cc" /* yacc.c:1646 */7659 #line 7660 "Parser/parser.cc" /* yacc.c:1646 */ 7648 7660 break; 7649 7661 7650 7662 case 656: 7651 #line 252 3"parser.yy" /* yacc.c:1646 */7663 #line 2525 "parser.yy" /* yacc.c:1646 */ 7652 7664 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[0].decl) ); } 7653 #line 76 54"Parser/parser.cc" /* yacc.c:1646 */7665 #line 7666 "Parser/parser.cc" /* yacc.c:1646 */ 7654 7666 break; 7655 7667 7656 7668 case 658: 7657 #line 25 29"parser.yy" /* yacc.c:1646 */7669 #line 2531 "parser.yy" /* yacc.c:1646 */ 7658 7670 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), 0, false ); } 7659 #line 76 60"Parser/parser.cc" /* yacc.c:1646 */7671 #line 7672 "Parser/parser.cc" /* yacc.c:1646 */ 7660 7672 break; 7661 7673 7662 7674 case 659: 7663 #line 253 1"parser.yy" /* yacc.c:1646 */7675 #line 2533 "parser.yy" /* yacc.c:1646 */ 7664 7676 { (yyval.decl) = DeclarationNode::newVarArray( 0 ); } 7665 #line 76 66"Parser/parser.cc" /* yacc.c:1646 */7677 #line 7678 "Parser/parser.cc" /* yacc.c:1646 */ 7666 7678 break; 7667 7679 7668 7680 case 660: 7669 #line 253 3"parser.yy" /* yacc.c:1646 */7681 #line 2535 "parser.yy" /* yacc.c:1646 */ 7670 7682 { (yyval.decl) = (yyvsp[-5].decl)->addArray( DeclarationNode::newArray( (yyvsp[-2].en), 0, false ) ); } 7671 #line 76 72"Parser/parser.cc" /* yacc.c:1646 */7683 #line 7684 "Parser/parser.cc" /* yacc.c:1646 */ 7672 7684 break; 7673 7685 7674 7686 case 661: 7675 #line 253 5"parser.yy" /* yacc.c:1646 */7687 #line 2537 "parser.yy" /* yacc.c:1646 */ 7676 7688 { (yyval.decl) = (yyvsp[-5].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); } 7677 #line 76 78"Parser/parser.cc" /* yacc.c:1646 */7689 #line 7690 "Parser/parser.cc" /* yacc.c:1646 */ 7678 7690 break; 7679 7691 7680 7692 case 663: 7681 #line 2550 "parser.yy" /* yacc.c:1646 */7682 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7683 #line 7684 "Parser/parser.cc" /* yacc.c:1646 */7684 break;7685 7686 case 664:7687 7693 #line 2552 "parser.yy" /* yacc.c:1646 */ 7688 7694 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7689 #line 7690 "Parser/parser.cc" /* yacc.c:1646 */ 7695 #line 7696 "Parser/parser.cc" /* yacc.c:1646 */ 7696 break; 7697 7698 case 664: 7699 #line 2554 "parser.yy" /* yacc.c:1646 */ 7700 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7701 #line 7702 "Parser/parser.cc" /* yacc.c:1646 */ 7690 7702 break; 7691 7703 7692 7704 case 665: 7693 #line 255 7"parser.yy" /* yacc.c:1646 */7705 #line 2559 "parser.yy" /* yacc.c:1646 */ 7694 7706 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 7695 #line 7 696"Parser/parser.cc" /* yacc.c:1646 */7707 #line 7708 "Parser/parser.cc" /* yacc.c:1646 */ 7696 7708 break; 7697 7709 7698 7710 case 666: 7699 #line 25 59"parser.yy" /* yacc.c:1646 */7711 #line 2561 "parser.yy" /* yacc.c:1646 */ 7700 7712 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); } 7701 #line 77 02"Parser/parser.cc" /* yacc.c:1646 */7713 #line 7714 "Parser/parser.cc" /* yacc.c:1646 */ 7702 7714 break; 7703 7715 7704 7716 case 667: 7705 #line 256 1"parser.yy" /* yacc.c:1646 */7717 #line 2563 "parser.yy" /* yacc.c:1646 */ 7706 7718 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7707 #line 77 08"Parser/parser.cc" /* yacc.c:1646 */7719 #line 7720 "Parser/parser.cc" /* yacc.c:1646 */ 7708 7720 break; 7709 7721 7710 7722 case 668: 7711 #line 256 3"parser.yy" /* yacc.c:1646 */7723 #line 2565 "parser.yy" /* yacc.c:1646 */ 7712 7724 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7713 #line 77 14"Parser/parser.cc" /* yacc.c:1646 */7725 #line 7726 "Parser/parser.cc" /* yacc.c:1646 */ 7714 7726 break; 7715 7727 7716 7728 case 669: 7717 #line 256 5"parser.yy" /* yacc.c:1646 */7729 #line 2567 "parser.yy" /* yacc.c:1646 */ 7718 7730 { (yyval.decl) = (yyvsp[-1].decl); } 7719 #line 77 20"Parser/parser.cc" /* yacc.c:1646 */7731 #line 7732 "Parser/parser.cc" /* yacc.c:1646 */ 7720 7732 break; 7721 7733 7722 7734 case 671: 7723 #line 2571 "parser.yy" /* yacc.c:1646 */7724 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7725 #line 7726 "Parser/parser.cc" /* yacc.c:1646 */7726 break;7727 7728 case 672:7729 7735 #line 2573 "parser.yy" /* yacc.c:1646 */ 7730 7736 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7731 #line 7732 "Parser/parser.cc" /* yacc.c:1646 */ 7737 #line 7738 "Parser/parser.cc" /* yacc.c:1646 */ 7738 break; 7739 7740 case 672: 7741 #line 2575 "parser.yy" /* yacc.c:1646 */ 7742 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7743 #line 7744 "Parser/parser.cc" /* yacc.c:1646 */ 7732 7744 break; 7733 7745 7734 7746 case 673: 7735 #line 257 5"parser.yy" /* yacc.c:1646 */7747 #line 2577 "parser.yy" /* yacc.c:1646 */ 7736 7748 { (yyval.decl) = (yyvsp[-1].decl); } 7737 #line 77 38"Parser/parser.cc" /* yacc.c:1646 */7749 #line 7750 "Parser/parser.cc" /* yacc.c:1646 */ 7738 7750 break; 7739 7751 7740 7752 case 674: 7741 #line 258 0"parser.yy" /* yacc.c:1646 */7753 #line 2582 "parser.yy" /* yacc.c:1646 */ 7742 7754 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[-2].decl), 0 ); } 7743 #line 77 44"Parser/parser.cc" /* yacc.c:1646 */7755 #line 7756 "Parser/parser.cc" /* yacc.c:1646 */ 7744 7756 break; 7745 7757 7746 7758 case 675: 7747 #line 258 2"parser.yy" /* yacc.c:1646 */7759 #line 2584 "parser.yy" /* yacc.c:1646 */ 7748 7760 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7749 #line 77 50"Parser/parser.cc" /* yacc.c:1646 */7761 #line 7762 "Parser/parser.cc" /* yacc.c:1646 */ 7750 7762 break; 7751 7763 7752 7764 case 676: 7753 #line 258 4"parser.yy" /* yacc.c:1646 */7765 #line 2586 "parser.yy" /* yacc.c:1646 */ 7754 7766 { (yyval.decl) = (yyvsp[-1].decl); } 7755 #line 77 56"Parser/parser.cc" /* yacc.c:1646 */7767 #line 7768 "Parser/parser.cc" /* yacc.c:1646 */ 7756 7768 break; 7757 7769 7758 7770 case 678: 7759 #line 259 1"parser.yy" /* yacc.c:1646 */7771 #line 2593 "parser.yy" /* yacc.c:1646 */ 7760 7772 { (yyval.decl) = (yyvsp[-1].decl)->addArray( (yyvsp[0].decl) ); } 7761 #line 77 62"Parser/parser.cc" /* yacc.c:1646 */7773 #line 7774 "Parser/parser.cc" /* yacc.c:1646 */ 7762 7774 break; 7763 7775 7764 7776 case 680: 7765 #line 260 2"parser.yy" /* yacc.c:1646 */7777 #line 2604 "parser.yy" /* yacc.c:1646 */ 7766 7778 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 7767 #line 77 68"Parser/parser.cc" /* yacc.c:1646 */7779 #line 7780 "Parser/parser.cc" /* yacc.c:1646 */ 7768 7780 break; 7769 7781 7770 7782 case 681: 7771 #line 260 5"parser.yy" /* yacc.c:1646 */7783 #line 2607 "parser.yy" /* yacc.c:1646 */ 7772 7784 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[-3].decl) ); } 7773 #line 77 74"Parser/parser.cc" /* yacc.c:1646 */7785 #line 7786 "Parser/parser.cc" /* yacc.c:1646 */ 7774 7786 break; 7775 7787 7776 7788 case 682: 7777 #line 260 7"parser.yy" /* yacc.c:1646 */7789 #line 2609 "parser.yy" /* yacc.c:1646 */ 7778 7790 { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[-2].decl), false ); } 7779 #line 77 80"Parser/parser.cc" /* yacc.c:1646 */7791 #line 7792 "Parser/parser.cc" /* yacc.c:1646 */ 7780 7792 break; 7781 7793 7782 7794 case 683: 7783 #line 261 0"parser.yy" /* yacc.c:1646 */7795 #line 2612 "parser.yy" /* yacc.c:1646 */ 7784 7796 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), false ); } 7785 #line 77 86"Parser/parser.cc" /* yacc.c:1646 */7797 #line 7798 "Parser/parser.cc" /* yacc.c:1646 */ 7786 7798 break; 7787 7799 7788 7800 case 684: 7789 #line 261 2"parser.yy" /* yacc.c:1646 */7801 #line 2614 "parser.yy" /* yacc.c:1646 */ 7790 7802 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), true ); } 7791 #line 7 792"Parser/parser.cc" /* yacc.c:1646 */7803 #line 7804 "Parser/parser.cc" /* yacc.c:1646 */ 7792 7804 break; 7793 7805 7794 7806 case 685: 7795 #line 261 4"parser.yy" /* yacc.c:1646 */7807 #line 2616 "parser.yy" /* yacc.c:1646 */ 7796 7808 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-4].decl), true ); } 7797 #line 7 798"Parser/parser.cc" /* yacc.c:1646 */7809 #line 7810 "Parser/parser.cc" /* yacc.c:1646 */ 7798 7810 break; 7799 7811 7800 7812 case 687: 7801 #line 2628 "parser.yy" /* yacc.c:1646 */7802 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); }7803 #line 7804 "Parser/parser.cc" /* yacc.c:1646 */7804 break;7805 7806 case 688:7807 7813 #line 2630 "parser.yy" /* yacc.c:1646 */ 7808 7814 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7809 #line 7810 "Parser/parser.cc" /* yacc.c:1646 */ 7815 #line 7816 "Parser/parser.cc" /* yacc.c:1646 */ 7816 break; 7817 7818 case 688: 7819 #line 2632 "parser.yy" /* yacc.c:1646 */ 7820 { (yyval.decl) = (yyvsp[-1].decl)->addQualifiers( (yyvsp[0].decl) ); } 7821 #line 7822 "Parser/parser.cc" /* yacc.c:1646 */ 7810 7822 break; 7811 7823 7812 7824 case 689: 7813 #line 263 5"parser.yy" /* yacc.c:1646 */7825 #line 2637 "parser.yy" /* yacc.c:1646 */ 7814 7826 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 7815 #line 78 16"Parser/parser.cc" /* yacc.c:1646 */7827 #line 7828 "Parser/parser.cc" /* yacc.c:1646 */ 7816 7828 break; 7817 7829 7818 7830 case 690: 7819 #line 263 7"parser.yy" /* yacc.c:1646 */7831 #line 2639 "parser.yy" /* yacc.c:1646 */ 7820 7832 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[0].decl) ); } 7821 #line 78 22"Parser/parser.cc" /* yacc.c:1646 */7833 #line 7834 "Parser/parser.cc" /* yacc.c:1646 */ 7822 7834 break; 7823 7835 7824 7836 case 691: 7825 #line 26 39"parser.yy" /* yacc.c:1646 */7837 #line 2641 "parser.yy" /* yacc.c:1646 */ 7826 7838 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 7827 #line 78 28"Parser/parser.cc" /* yacc.c:1646 */7839 #line 7840 "Parser/parser.cc" /* yacc.c:1646 */ 7828 7840 break; 7829 7841 7830 7842 case 692: 7831 #line 264 1"parser.yy" /* yacc.c:1646 */7843 #line 2643 "parser.yy" /* yacc.c:1646 */ 7832 7844 { (yyval.decl) = (yyvsp[0].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[-1].decl) ) ); } 7833 #line 78 34"Parser/parser.cc" /* yacc.c:1646 */7845 #line 7846 "Parser/parser.cc" /* yacc.c:1646 */ 7834 7846 break; 7835 7847 7836 7848 case 693: 7837 #line 264 3"parser.yy" /* yacc.c:1646 */7849 #line 2645 "parser.yy" /* yacc.c:1646 */ 7838 7850 { (yyval.decl) = (yyvsp[-1].decl); } 7839 #line 78 40"Parser/parser.cc" /* yacc.c:1646 */7851 #line 7852 "Parser/parser.cc" /* yacc.c:1646 */ 7840 7852 break; 7841 7853 7842 7854 case 695: 7843 #line 2649 "parser.yy" /* yacc.c:1646 */7844 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); }7845 #line 7846 "Parser/parser.cc" /* yacc.c:1646 */7846 break;7847 7848 case 696:7849 7855 #line 2651 "parser.yy" /* yacc.c:1646 */ 7850 7856 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7851 #line 7852 "Parser/parser.cc" /* yacc.c:1646 */ 7857 #line 7858 "Parser/parser.cc" /* yacc.c:1646 */ 7858 break; 7859 7860 case 696: 7861 #line 2653 "parser.yy" /* yacc.c:1646 */ 7862 { (yyval.decl) = (yyvsp[-2].decl)->addArray( (yyvsp[0].decl) ); } 7863 #line 7864 "Parser/parser.cc" /* yacc.c:1646 */ 7852 7864 break; 7853 7865 7854 7866 case 697: 7855 #line 2653 "parser.yy" /* yacc.c:1646 */ 7856 { (yyval.decl) = (yyvsp[-1].decl); } 7857 #line 7858 "Parser/parser.cc" /* yacc.c:1646 */ 7858 break; 7859 7860 case 698: 7861 #line 2658 "parser.yy" /* yacc.c:1646 */ 7862 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7863 #line 7864 "Parser/parser.cc" /* yacc.c:1646 */ 7864 break; 7865 7866 case 699: 7867 #line 2660 "parser.yy" /* yacc.c:1646 */ 7867 #line 2655 "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 2660 "parser.yy" /* yacc.c:1646 */ 7874 { (yyval.decl) = (yyvsp[-6].decl)->addParamList( (yyvsp[-2].decl) ); } 7875 #line 7876 "Parser/parser.cc" /* yacc.c:1646 */ 7876 break; 7877 7878 case 699: 7879 #line 2662 "parser.yy" /* yacc.c:1646 */ 7880 { (yyval.decl) = (yyvsp[-1].decl); } 7881 #line 7882 "Parser/parser.cc" /* yacc.c:1646 */ 7882 break; 7883 7872 7884 case 702: 7873 #line 267 0"parser.yy" /* yacc.c:1646 */7885 #line 2672 "parser.yy" /* yacc.c:1646 */ 7874 7886 { (yyval.decl) = (yyvsp[0].decl)->addQualifiers( (yyvsp[-1].decl) ); } 7875 #line 78 76"Parser/parser.cc" /* yacc.c:1646 */7887 #line 7888 "Parser/parser.cc" /* yacc.c:1646 */ 7876 7888 break; 7877 7889 7878 7890 case 705: 7879 #line 2680 "parser.yy" /* yacc.c:1646 */7880 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }7881 #line 7882 "Parser/parser.cc" /* yacc.c:1646 */7882 break;7883 7884 case 706:7885 7891 #line 2682 "parser.yy" /* yacc.c:1646 */ 7886 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); }7887 #line 7888 "Parser/parser.cc" /* yacc.c:1646 */7888 break;7889 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 8:7897 #line 268 6"parser.yy" /* yacc.c:1646 */7896 case 706: 7897 #line 2684 "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 9:7903 #line 268 8"parser.yy" /* yacc.c:1646 */7902 case 707: 7903 #line 2686 "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 10:7909 #line 26 90"parser.yy" /* yacc.c:1646 */7908 case 708: 7909 #line 2688 "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 709: 7915 #line 2690 "parser.yy" /* yacc.c:1646 */ 7916 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 7917 #line 7918 "Parser/parser.cc" /* yacc.c:1646 */ 7918 break; 7919 7920 case 710: 7921 #line 2692 "parser.yy" /* yacc.c:1646 */ 7922 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 7923 #line 7924 "Parser/parser.cc" /* yacc.c:1646 */ 7924 break; 7925 7914 7926 case 711: 7915 #line 269 7"parser.yy" /* yacc.c:1646 */7927 #line 2699 "parser.yy" /* yacc.c:1646 */ 7916 7928 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7917 #line 79 18"Parser/parser.cc" /* yacc.c:1646 */7929 #line 7930 "Parser/parser.cc" /* yacc.c:1646 */ 7918 7930 break; 7919 7931 7920 7932 case 712: 7921 #line 2 699"parser.yy" /* yacc.c:1646 */7933 #line 2701 "parser.yy" /* yacc.c:1646 */ 7922 7934 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 7923 #line 79 24"Parser/parser.cc" /* yacc.c:1646 */7935 #line 7936 "Parser/parser.cc" /* yacc.c:1646 */ 7924 7936 break; 7925 7937 7926 7938 case 713: 7927 #line 270 1"parser.yy" /* yacc.c:1646 */7939 #line 2703 "parser.yy" /* yacc.c:1646 */ 7928 7940 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7929 #line 79 30"Parser/parser.cc" /* yacc.c:1646 */7941 #line 7942 "Parser/parser.cc" /* yacc.c:1646 */ 7930 7942 break; 7931 7943 7932 7944 case 714: 7933 #line 270 3"parser.yy" /* yacc.c:1646 */7945 #line 2705 "parser.yy" /* yacc.c:1646 */ 7934 7946 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( (yyvsp[-2].decl) ); } 7935 #line 79 36"Parser/parser.cc" /* yacc.c:1646 */7947 #line 7948 "Parser/parser.cc" /* yacc.c:1646 */ 7936 7948 break; 7937 7949 7938 7950 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 7951 #line 2707 "parser.yy" /* yacc.c:1646 */ 7946 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }7947 #line 7948 "Parser/parser.cc" /* yacc.c:1646 */7948 break;7949 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 716: 7957 #line 2709 "parser.yy" /* yacc.c:1646 */ 7958 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7959 #line 7960 "Parser/parser.cc" /* yacc.c:1646 */ 7960 break; 7961 7962 case 717: 7963 #line 2711 "parser.yy" /* yacc.c:1646 */ 7964 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 7965 #line 7966 "Parser/parser.cc" /* yacc.c:1646 */ 7966 break; 7967 7956 7968 case 718: 7957 #line 271 1"parser.yy" /* yacc.c:1646 */7969 #line 2713 "parser.yy" /* yacc.c:1646 */ 7958 7970 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 7959 #line 79 60"Parser/parser.cc" /* yacc.c:1646 */7971 #line 7972 "Parser/parser.cc" /* yacc.c:1646 */ 7960 7972 break; 7961 7973 7962 7974 case 719: 7963 #line 271 3"parser.yy" /* yacc.c:1646 */7975 #line 2715 "parser.yy" /* yacc.c:1646 */ 7964 7976 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( (yyvsp[-2].decl) ); } 7965 #line 79 66"Parser/parser.cc" /* yacc.c:1646 */7977 #line 7978 "Parser/parser.cc" /* yacc.c:1646 */ 7966 7978 break; 7967 7979 7968 7980 case 720: 7969 #line 271 5"parser.yy" /* yacc.c:1646 */7981 #line 2717 "parser.yy" /* yacc.c:1646 */ 7970 7982 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 7971 #line 79 72"Parser/parser.cc" /* yacc.c:1646 */7983 #line 7984 "Parser/parser.cc" /* yacc.c:1646 */ 7972 7984 break; 7973 7985 7974 7986 case 721: 7975 #line 272 0"parser.yy" /* yacc.c:1646 */7987 #line 2722 "parser.yy" /* yacc.c:1646 */ 7976 7988 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[-3].decl) ); } 7977 #line 79 78"Parser/parser.cc" /* yacc.c:1646 */7989 #line 7990 "Parser/parser.cc" /* yacc.c:1646 */ 7978 7990 break; 7979 7991 7980 7992 case 722: 7981 #line 272 2"parser.yy" /* yacc.c:1646 */7993 #line 2724 "parser.yy" /* yacc.c:1646 */ 7982 7994 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), false ); } 7983 #line 79 84"Parser/parser.cc" /* yacc.c:1646 */7995 #line 7996 "Parser/parser.cc" /* yacc.c:1646 */ 7984 7996 break; 7985 7997 7986 7998 case 723: 7987 #line 272 7"parser.yy" /* yacc.c:1646 */7999 #line 2729 "parser.yy" /* yacc.c:1646 */ 7988 8000 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl), true ); } 7989 #line 7990"Parser/parser.cc" /* yacc.c:1646 */8001 #line 8002 "Parser/parser.cc" /* yacc.c:1646 */ 7990 8002 break; 7991 8003 7992 8004 case 724: 7993 #line 27 29"parser.yy" /* yacc.c:1646 */8005 #line 2731 "parser.yy" /* yacc.c:1646 */ 7994 8006 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[-2].en), (yyvsp[-3].decl)->addQualifiers( (yyvsp[-4].decl) ), true ); } 7995 #line 7996"Parser/parser.cc" /* yacc.c:1646 */8007 #line 8008 "Parser/parser.cc" /* yacc.c:1646 */ 7996 8008 break; 7997 8009 7998 8010 case 726: 7999 #line 275 6"parser.yy" /* yacc.c:1646 */8011 #line 2758 "parser.yy" /* yacc.c:1646 */ 8000 8012 { (yyval.decl) = (yyvsp[0].decl)->addQualifiers( (yyvsp[-1].decl) ); } 8001 #line 80 02"Parser/parser.cc" /* yacc.c:1646 */8013 #line 8014 "Parser/parser.cc" /* yacc.c:1646 */ 8002 8014 break; 8003 8015 8004 8016 case 730: 8005 #line 2767 "parser.yy" /* yacc.c:1646 */8006 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }8007 #line 8008 "Parser/parser.cc" /* yacc.c:1646 */8008 break;8009 8010 case 731:8011 8017 #line 2769 "parser.yy" /* yacc.c:1646 */ 8012 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); }8013 #line 8014 "Parser/parser.cc" /* yacc.c:1646 */8014 break;8015 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 3:8023 #line 277 3"parser.yy" /* yacc.c:1646 */8022 case 731: 8023 #line 2771 "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 4:8029 #line 277 5"parser.yy" /* yacc.c:1646 */8028 case 732: 8029 #line 2773 "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 5:8035 #line 277 7"parser.yy" /* yacc.c:1646 */8034 case 733: 8035 #line 2775 "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 734: 8041 #line 2777 "parser.yy" /* yacc.c:1646 */ 8042 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8043 #line 8044 "Parser/parser.cc" /* yacc.c:1646 */ 8044 break; 8045 8046 case 735: 8047 #line 2779 "parser.yy" /* yacc.c:1646 */ 8048 { (yyval.decl) = (yyvsp[0].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[-2].decl) ) ); } 8049 #line 8050 "Parser/parser.cc" /* yacc.c:1646 */ 8050 break; 8051 8040 8052 case 736: 8041 #line 278 4"parser.yy" /* yacc.c:1646 */8053 #line 2786 "parser.yy" /* yacc.c:1646 */ 8042 8054 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8043 #line 80 44"Parser/parser.cc" /* yacc.c:1646 */8055 #line 8056 "Parser/parser.cc" /* yacc.c:1646 */ 8044 8056 break; 8045 8057 8046 8058 case 737: 8047 #line 278 6"parser.yy" /* yacc.c:1646 */8059 #line 2788 "parser.yy" /* yacc.c:1646 */ 8048 8060 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8049 #line 80 50"Parser/parser.cc" /* yacc.c:1646 */8061 #line 8062 "Parser/parser.cc" /* yacc.c:1646 */ 8050 8062 break; 8051 8063 8052 8064 case 738: 8053 #line 27 88"parser.yy" /* yacc.c:1646 */8065 #line 2790 "parser.yy" /* yacc.c:1646 */ 8054 8066 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 8055 #line 80 56"Parser/parser.cc" /* yacc.c:1646 */8067 #line 8068 "Parser/parser.cc" /* yacc.c:1646 */ 8056 8068 break; 8057 8069 8058 8070 case 739: 8059 #line 279 0"parser.yy" /* yacc.c:1646 */8071 #line 2792 "parser.yy" /* yacc.c:1646 */ 8060 8072 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8061 #line 80 62"Parser/parser.cc" /* yacc.c:1646 */8073 #line 8074 "Parser/parser.cc" /* yacc.c:1646 */ 8062 8074 break; 8063 8075 8064 8076 case 740: 8065 #line 279 2"parser.yy" /* yacc.c:1646 */8077 #line 2794 "parser.yy" /* yacc.c:1646 */ 8066 8078 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8067 #line 80 68"Parser/parser.cc" /* yacc.c:1646 */8079 #line 8080 "Parser/parser.cc" /* yacc.c:1646 */ 8068 8080 break; 8069 8081 8070 8082 case 741: 8071 #line 279 4"parser.yy" /* yacc.c:1646 */8083 #line 2796 "parser.yy" /* yacc.c:1646 */ 8072 8084 { (yyval.decl) = (yyvsp[0].decl)->addNewArray( (yyvsp[-1].decl) ); } 8073 #line 80 74"Parser/parser.cc" /* yacc.c:1646 */8085 #line 8086 "Parser/parser.cc" /* yacc.c:1646 */ 8074 8086 break; 8075 8087 8076 8088 case 742: 8077 #line 2 799"parser.yy" /* yacc.c:1646 */8089 #line 2801 "parser.yy" /* yacc.c:1646 */ 8078 8090 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[-2].decl) ); } 8079 #line 80 80"Parser/parser.cc" /* yacc.c:1646 */8091 #line 8092 "Parser/parser.cc" /* yacc.c:1646 */ 8080 8092 break; 8081 8093 8082 8094 case 743: 8083 #line 280 4"parser.yy" /* yacc.c:1646 */8095 #line 2806 "parser.yy" /* yacc.c:1646 */ 8084 8096 { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[-1].decl), 0 ); } 8085 #line 80 86"Parser/parser.cc" /* yacc.c:1646 */8097 #line 8098 "Parser/parser.cc" /* yacc.c:1646 */ 8086 8098 break; 8087 8099 8088 8100 case 744: 8089 #line 2806 "parser.yy" /* yacc.c:1646 */8090 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[-5].decl), (yyvsp[-2].decl), 0 ); }8091 #line 8092 "Parser/parser.cc" /* yacc.c:1646 */8092 break;8093 8094 case 745:8095 8101 #line 2808 "parser.yy" /* yacc.c:1646 */ 8096 8102 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[-5].decl), (yyvsp[-2].decl), 0 ); } 8097 #line 8098 "Parser/parser.cc" /* yacc.c:1646 */ 8103 #line 8104 "Parser/parser.cc" /* yacc.c:1646 */ 8104 break; 8105 8106 case 745: 8107 #line 2810 "parser.yy" /* yacc.c:1646 */ 8108 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[-5].decl), (yyvsp[-2].decl), 0 ); } 8109 #line 8110 "Parser/parser.cc" /* yacc.c:1646 */ 8098 8110 break; 8099 8111 8100 8112 case 748: 8101 #line 283 2"parser.yy" /* yacc.c:1646 */8113 #line 2834 "parser.yy" /* yacc.c:1646 */ 8102 8114 { (yyval.en) = 0; } 8103 #line 81 04"Parser/parser.cc" /* yacc.c:1646 */8115 #line 8116 "Parser/parser.cc" /* yacc.c:1646 */ 8104 8116 break; 8105 8117 8106 8118 case 749: 8107 #line 283 4"parser.yy" /* yacc.c:1646 */8119 #line 2836 "parser.yy" /* yacc.c:1646 */ 8108 8120 { (yyval.en) = (yyvsp[0].en); } 8109 #line 81 10"Parser/parser.cc" /* yacc.c:1646 */8110 break; 8111 8112 8113 #line 81 14"Parser/parser.cc" /* yacc.c:1646 */8121 #line 8122 "Parser/parser.cc" /* yacc.c:1646 */ 8122 break; 8123 8124 8125 #line 8126 "Parser/parser.cc" /* yacc.c:1646 */ 8114 8126 default: break; 8115 8127 } … … 8339 8351 return yyresult; 8340 8352 } 8341 #line 283 7"parser.yy" /* yacc.c:1906 */8353 #line 2839 "parser.yy" /* yacc.c:1906 */ 8342 8354 8343 8355 // ----end of grammar---- -
src/Parser/parser.yy
r04cdd9b re85a8631 2105 2105 // empty 2106 2106 | ASM '(' string_literal_list ')' attribute_list_opt 2107 { delete $3; } 2107 2108 ; 2108 2109 … … 2134 2135 | any_word 2135 2136 | any_word '(' comma_expression_opt ')' 2137 { delete $3; } 2136 2138 ; 2137 2139 2138 2140 any_word: // GCC 2139 identifier_or_type_name { }2140 | storage_class { }2141 | basic_type_name { }2142 | type_qualifier { }2141 identifier_or_type_name { delete $1; } 2142 | storage_class { delete $1; } 2143 | basic_type_name { delete $1; } 2144 | type_qualifier { delete $1; } 2143 2145 ; 2144 2146 -
src/SynTree/Expression.cc
r04cdd9b re85a8631 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 way 387 388 } 388 389 -
src/SynTree/FunctionDecl.cc
r04cdd9b re85a8631 39 39 delete type; 40 40 delete statements; 41 deleteAll( oldDecls ); 41 42 } 42 43 -
src/SynTree/Statement.cc
r04cdd9b re85a8631 159 159 delete condition; 160 160 // destroy statements 161 deleteAll( statements ); 161 162 } 162 163 … … 187 188 CaseStmt::~CaseStmt() { 188 189 delete condition; 190 deleteAll( stmts ); 189 191 } 190 192 … … 220 222 WhileStmt::~WhileStmt() { 221 223 delete body; 224 delete condition; 222 225 } 223 226 … … 294 297 TryStmt::~TryStmt() { 295 298 delete block; 299 deleteAll( handlers ); 300 delete finallyBlock; 296 301 } 297 302 -
src/include/assert.h
r04cdd9b re85a8631 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 // 14 // 15 16 #pragma once 15 17 16 18 #include_next <assert.h> … … 22 24 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ); 23 25 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 24 33 // Local Variables: // 25 34 // tab-width: 4 // -
src/main.cc
r04cdd9b re85a8631 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 19 08:31:22 201613 // Update Count : 35012 // Last Modified On : Sat Aug 20 12:52:22 2016 13 // Update Count : 403 14 14 // 15 15 16 16 #include <iostream> 17 17 #include <fstream> 18 #include <getopt.h> 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 19 25 #include "Parser/lex.h" 20 26 #include "Parser/parser.h" … … 35 41 #include "InitTweak/FixInit.h" 36 42 #include "Common/UnimplementedError.h" 37 38 43 #include "../config.h" 39 44 40 45 using namespace std; 41 46 42 #define OPTPRINT(x) if ( errorp ) std::cerr << x << std::endl;47 #define OPTPRINT(x) if ( errorp ) cerr << x << endl; 43 48 44 49 … … 68 73 static void parse_cmdline( int argc, char *argv[], const char *& filename ); 69 74 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false ); 70 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out = std::cout ); 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 71 126 72 127 int main( int argc, char * argv[] ) { 73 128 FILE * input; // use FILE rather than istream because yyin is FILE 74 std::ostream *output = & std::cout; 75 std::list< Declaration * > translationUnit; 129 ostream *output = & cout; 76 130 const char *filename = nullptr; 131 list< Declaration * > translationUnit; 132 133 signal( SIGSEGV, sigSegvBusHandler ); 134 signal( SIGBUS, sigSegvBusHandler ); 77 135 78 136 parse_cmdline( argc, argv, filename ); // process command-line arguments … … 122 180 123 181 if ( parsep ) { 124 parseTree->printList( std::cout );182 parseTree->printList( cout ); 125 183 delete parseTree; 126 184 return 0; … … 144 202 145 203 if ( expraltp ) { 146 ResolvExpr::AlternativePrinter printer( std::cout );204 ResolvExpr::AlternativePrinter printer( cout ); 147 205 acceptAll( translationUnit, printer ); 148 206 return 0; … … 210 268 CodeGen::generate( translationUnit, *output, ! noprotop ); 211 269 212 if ( output != & std::cout ) {270 if ( output != &cout ) { 213 271 delete output; 214 272 } // if 215 273 } catch ( SemanticError &e ) { 216 274 if ( errorp ) { 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 ) {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 ) { 223 281 delete output; 224 282 } // if 225 283 return 1; 226 284 } catch ( UnimplementedError &e ) { 227 std::cout << "Sorry, " << e.get_what() << " is not currently implemented" << std::endl;228 if ( output != & std::cout ) {285 cout << "Sorry, " << e.get_what() << " is not currently implemented" << endl; 286 if ( output != &cout ) { 229 287 delete output; 230 288 } // if 231 289 return 1; 232 290 } catch ( CompilerError &e ) { 233 std::cerr << "Compiler Error: " << e.get_what() << std::endl;234 std::cerr << "(please report bugs to " << std::endl;235 if ( output != & std::cout ) {291 cerr << "Compiler Error: " << e.get_what() << endl; 292 cerr << "(please report bugs to " << endl; 293 if ( output != &cout ) { 236 294 delete output; 237 295 } // if … … 369 427 } // notPrelude 370 428 371 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out ) {372 std::list< Declaration * > decls;429 static void dump( list< Declaration * > & translationUnit, ostream & out ) { 430 list< Declaration * > decls; 373 431 374 432 if ( noprotop ) { 375 filter( translationUnit.begin(), translationUnit.end(), std::back_inserter( decls ), notPrelude );433 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), notPrelude ); 376 434 } else { 377 435 decls = translationUnit;
Note: See TracChangeset
for help on using the changeset viewer.