ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
compilerplugin.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_expressions of the \aliblong.
4///
5/// Copyright 2013-2026 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace expressions {
9
10//==================================================================================================
11/// This interface class represents "plug-ins" which are attachable to container class
12/// #"Compiler". The compiler uses the plug-ins to <em>"compile"</em> single
13/// nodes of <em>abstract syntax trees</em>, which are the intermediate, internal result of parsing
14/// expression strings.
15///
16/// In depth information on how this class is used is given in the
17/// #"alib::expressions;User Manual And Tutorial" of module \alib_expressions_nl.
18///
19/// The overloaded methods #".TryCompilation(CIFunc)" are not abstract, but have a default implementation
20/// that return constant \c false. A plug-in derived from this class needs to override only those
21/// methods that represent syntax elements of an expression, that it volunteers to take
22/// responsibility for.
23///
24/// The overloaded methods have one input/output parameter which is of one of the following types:
25/// - #"CompilerPlugin::CIFunction",
26/// - #"CompilerPlugin::CIUnaryOp",
27/// - #"CompilerPlugin::CIBinaryOp" or
28/// - #"CompilerPlugin::CIAutoCast".
29///
30/// These inner types of this struct are derived from likewise inner struct
31/// #"CompilerPlugin::CompilationInfo", which provides all output members and
32/// those input members that are common between the four descendants. In other words, the variants
33/// of the struct provide detail information on the node that is actually compiled.
34///
35/// When overriding one of the overloaded methods #".TryCompilation(CIFunc)", it has to be checked
36/// if the custom plug-in is responsible for the permutation of given parameter types which
37/// are passed.
38/// If so, the actual 'compilation' is performed, by filling the result members of the given
39/// struct and by returning \c true. Each overloaded
40/// method provides a suitable return type, which are defined as inner types of this class.
41///
42/// The output information comprises a #"alib_expressions_prereq_sb;sample box" that
43/// determines the result type of the native C++ function that is later invoked when the expression
44/// is evaluated against a scope.
45/// Together with this type information, the pointer to the callback function itself needs to be
46/// set in the given struct.
47///
48/// Alternatively, if a constant result is to be returned, the pointer to the callback function
49/// might be kept \e nulled. In this case, the #"%Box" object that represents the result type
50/// of the callback function is used to provide the constant value, instead of just a sample value.
51///
52/// There are two possibilities, why a compiler plug-in might return a constant value, instead of
53/// a function:
54/// 1. \e Identifiers (parameterless functions) might just represent constant values. (For example
55/// identifiers \c "True" or \c "Monday" do that, while \c "Today" returns a callback function.).
56/// 2. The compiler provides information about whether the given parameters are constant values.
57/// In this case, a compiler plug-in may decide to evaluate the result of the function at
58/// compile-time. This is often, but not always possible and depends largely on the fact
59/// if scope information is used with the function as well. <br>
60/// For more details on this topic see manual section
61/// #"alib_expressions_details_optimizations".
62///
63/// \attention
64/// If constant data is returned, it has to be assured, that the contents of the returned
65/// #"%Box" remains valid during the life-cycle of the expression. This is ensured for all
66/// C++ fundamental types. For custom types it depends on where the constant value is received
67/// from and how boxing is performed.
68/// (By default, custom types bigger as two "words" (2 x 64/32 bits) are boxed as pointers to the
69/// assigned object.)<br>
70/// Field #"CompileTimeScope"
71/// is to be used for compile-time allocations.
72///
73/// The plug-ins are attached to the #"%Compiler" using a dedicated prioritization defined
74/// with (arithmetical) enum type #"CompilePriorities".
75/// This means, that if a higher prioritized plug-in already compiles a certain
76/// permutation of expression node type and argument types, then a lower prioritized plug-in is not
77/// even asked to do so. With this concept, <b>ALib Expressions</b> provides a lot of flexibility:
78/// the built-in operators and identifiers can be unplugged completely or just sparsely "superseded"
79/// in certain aspects by adding a custom #"%CompilerPlugin" with a higher priority than that of
80/// the built-in one.
81///
82/// \note
83/// Instead of deriving from this struct, it is recommended to consider convenience struct
84/// #"plugins::Calculus;*" instead.
85///
86/// \note
87/// More information on this topic is given in manual section
88/// #"alib_expressions_cpcc_calculus"
89//==================================================================================================
90struct CompilerPlugin : public lang::Plugin<Compiler, CompilePriorities> {
91 /// The name of the plug-in. This is used with exception information and with
92 /// #"VirtualMachine::DbgList;program listings" which are available in
93 /// debug-compilations of the library.
95
96 /// The compiler that this plug-in is attached to.
98
99 /// Public inner base struct which provides input and output information for compiling
100 /// single entities (nodes of the \e AST) of a parsed expression.
101 ///
102 /// Descendant types
103 /// - #"CompilerPlugin::CIFunction",
104 /// - #"CompilerPlugin::CIUnaryOp" and
105 /// - #"CompilerPlugin::CIBinaryOp"
106 ///
107 /// extend this struct with input information, specific to the type of <em>AST</em>-node
108 /// currently compiled. Special, descendant type
109 /// - #"CompilerPlugin::CIAutoCast"
110 ///
111 /// in addition adds specific output members.
112 ///
113 /// Together, these four descendants comprise the parameters of the four overloaded methods
114 /// #"CompilerPlugin::TryCompilation(CIUnary)".
116 /// The scope found here is the same object passed to the method
117 /// #"Compiler::Compile;*", which internally invokes the overloaded methods
118 /// #"CompilerPlugin::TryCompilation(CIFunc);2", that receive an object of this type.
119 ///
120 /// If a compiled expression syntax element evaluates to a constant stored in
121 /// #"TypeOrValue" it has to be ensured that the boxed data is to available during the
122 /// life-cycle of the expression.
123 ///
124 /// To allocate custom compilation data, a custom, derived type, might, for example, be
125 /// extended with simple\c std::vector of pointers to the created objects.
126 /// (Attention: Vectors of value-types must not be used, as with their growth, the objects
127 /// get moved within the heap memory!).<br>.
128 /// Any data allocated, is to be deleted in the virtual destructor of the custom scope type.
130
131 /// An allocator to be used exclusively during compile-time.
132 /// Its memory is cleared (respectively reset to a previous state) after the compilation
133 /// completed.<br>
134 /// (Refers to object #"Compiler::allocator;*".)
136
137 /// Input: A start iterator to #"alib_expressions_prereq_sb;sample boxes"
138 /// that provide the argument types to search a native callback function for.<br>
139 /// In case that descendant classes denote that arguments found in this iterator are
140 /// constant, then the boxes are not just sample boxes, but contain the constant values.
142
143 /// Input: The end iterator to #"ArgsBegin". The expression <c>ArgsEnd - ArgsBegin</c> may be
144 /// used to receive the number of arguments provided.
146
147 #if ALIB_DEBUG
148 /// Output: The C++ name of the callback function. This field is available only in debug
149 /// compilations of the library. Hence, setting it must be performed with preprocessor
150 /// conditionals.
151 const nchar* DbgCallbackName =nullptr;
152 #endif
153
154 /// Output: The native C++ callback function to be set by one of the plug-ins.
156
157 /// Output: Specifies the return type of #".Callback", respectively, as the name indicates, the
158 /// result value in case of constant results.<br>
159 /// Note that in case of constant compile-time values, it might be necessary to allocate
160 /// compile-time memory for the values. For this, field #"CompileTimeScope" is to be used.
161 Box TypeOrValue = nullptr;
162
163
164 /// Constructor.
165 /// @param scope The scope usable for allocation of constant values (compile-time
166 /// allocations). Assigned to field #"CompileTimeScope".
167 /// @param allocator Assigned to field #"CompileTimeAllocator".
168 ///
169 CompilationInfo( Scope& scope, MonoAllocator& allocator )
170 : CompileTimeScope ( scope )
171 , CompileTimeAllocator ( allocator )
172 , ArgsBegin ( scope.Stack->begin())
173 , ArgsEnd ( scope.Stack->end() ) {}
174 };
175
176 /// Info struct for compiling expression identifiers and functions.
177 /// This struct is used with method #"TryCompilation(CIFunction&)" to provide information
178 /// to derived compiler plug-ins, as well as to receive information back.
179 struct CIFunction : public CompilationInfo {
180 /// Input: The identifier name to search.
182
183 /// Input: If the function was given as a pure "identifier" this flag is \c true.
184 /// \see See also flag
185 /// #"Compilation::AllowOmittingParenthesesOfParameterlessFunctions" of
186 /// field \see See also #"Compiler::CfgCompilation.;*".
188
189 /// Input: Denotes if all arguments provided are constant values. Operator callbacks that do
190 /// not use context information from the scope, should calculate the then constant result
191 /// and return this value instead of the callback method. (Compile-time optimization.)
193
194 /// A plug-in may add names of functions that matched, while the arguments did not.
195 /// This will be stored in the details of a potential exception, if no other plug-in
196 /// compiles this function and may be displayed to the end-user.
197 ///
198 /// To add entries here, convenience method #"AddFunctionsWithNonMatchingArguments" is
199 /// provided.
201
202 /// Constructor.
203 /// @param scope Passed to parent.
204 /// @param compileTimeAllocator Passed to parent.
205 /// @param name Stored in #".Name".
206 /// @param isIdentifier Stored in #".IsIdentifier".
207 /// @param argsAreConst Passed to #".AllArgsAreConst".
208 /// @param hints Stored in #".FunctionsWithNonMatchingArguments".
210 MonoAllocator& compileTimeAllocator,
211 AString& name,
212 bool isIdentifier,
213 bool argsAreConst,
214 ListMA<String>& hints )
215 : CompilationInfo(scope, compileTimeAllocator)
216 , Name (name)
217 , IsIdentifier (isIdentifier)
218 , AllArgsAreConst(argsAreConst)
220
221
222 /// Returns the number of arguments given.
223 /// @return The number of arguments the function call requested.
224 size_t QtyArgs() { return size_t( ArgsEnd - ArgsBegin ); }
225
226 /// Returns the argument number \p{no}.
227 /// @param no The number of the argument requested.
228 /// @return A reference to the requested argument.
229 Box& Arg( size_t no ) { return *(ArgsBegin + static_cast<ptrdiff_t>( no ) ); }
230
231 /// Convenience method that adds creates a monotonically allocated copy of the given string
232 /// and adds it to list #".FunctionsWithNonMatchingArguments".
233 ///
234 /// @param signature The function signature to add.
237 };
238
239 /// Info struct for compiling an unary operator.
240 /// This struct is used with method #"TryCompilation(CIUnaryOp&)" to provide information
241 /// to derived compiler plug-ins, as well as to receive information back.
242 struct CIUnaryOp : public CompilationInfo {
243 String& Operator; ///< Input/Output: The unary operator.
244
245 /// Input: Denotes if the argument is a constant value. Operator callbacks that do
246 /// not use context information from the scope, should calculate the then constant result
247 /// and return this value instead of the callback method. (Compile-time optimization.)
249
250
251 /// Constructor.
252 /// @param scope Passed to parent.
253 /// @param compileTimeAllocator Passed to parent.
254 /// @param op Stored in #".Operator".
255 /// @param argIsConst Passed to field #".ArgIsConst".
256 CIUnaryOp( Scope& scope , MonoAllocator& compileTimeAllocator,
257 String& op , bool argIsConst )
258 : CompilationInfo( scope, compileTimeAllocator )
259 , Operator ( op )
260 , ArgIsConst ( argIsConst ) {}
261 };
262
263 /// Info struct for compiling a binary operator.
264 /// This struct is used with method #"TryCompilation(CIBinaryOp&)" to provide information
265 /// to derived compiler plug-ins, as well as to receive information back.
266 ///
267 /// Information about whether the arguments are constants is separately given for \e lhs and
268 /// \e rhs with fields #".LhsIsConst" and #".RhsIsConst".
269 ///
270 /// If both flags evaluate to \c true, operator callback functions that do not use context
271 /// information from the scope (or otherwise rely on external or random data), should calculate
272 /// the - then constant - result at compile-time and return a constant value instead of the
273 /// callback method.
274 ///
275 /// If exactly one of the argument is constant, then some operators might detect further
276 /// possibilities of optimization. Such optimization is operator-specific but goes along the
277 /// lines of the following samples:
278 ///
279 /// term + 0 -> term
280 /// term - 0 -> term
281 /// term * 0 -> 0
282 /// term * 1 -> term
283 /// term / 1 -> term
284 /// term && false -> false
285 /// term && true -> term
286 /// term || true -> true
287 /// term || false -> term
288 ///
289 /// These cases have in common that the result of the operator is either a constant
290 /// or equals the non-constant argument.
291 ///
292 /// In both cases the inherited field #"^.Callback" is to be left \c nullptr. If the result is
293 /// constant, inherited field #"%TypeOrValue" is to be set to the constant value.
294 /// In the second case that the non-constant argument equals the result, this can be indicated
295 /// by setting field #".NonConstArgIsResult" to \c true. In this case, the compiler will choose
296 /// the non-constant argument and drop the other.
297 ///
298 /// \note
299 /// Class #"plugins::Calculus" which specializes this plug-in class,
300 /// provides a convenient way to define the optimization rules described here, along with
301 /// its mechanics to support binary operator compilation.
302 struct CIBinaryOp : public CompilationInfo {
303 String& Operator; ///< Input/Output: The binary operator symbol.
304
305 /// Input: Denotes if the lhs-argument is a constant value.
307
308 /// Input: Denotes if the rhs-argument is a constant value.
310
311 /// Output: Used with optimization, see this struct's documentation for more information.
313
314
315 /// Constructor.
316 /// @param scope Passed to parent.
317 /// @param compileTimeAllocator Passed to parent.
318 /// @param op Stored in #".Operator".
319 /// @param lhsIsConst Stored in #".LhsIsConst".
320 /// @param rhsIsConst Stored in #".RhsIsConst".
321 CIBinaryOp( Scope& scope, MonoAllocator& compileTimeAllocator,
322 String& op, bool lhsIsConst, bool rhsIsConst)
323 : CompilationInfo ( scope, compileTimeAllocator )
324 , Operator ( op )
325 , LhsIsConst ( lhsIsConst )
326 , RhsIsConst ( rhsIsConst )
327 , NonConstArgIsResult( false ) {}
328 };
329
330 /// Info struct for compiling automatic type casts. Such automatic cast is tried to be inserted
331 /// into the expression program by the compiler if:
332 ///
333 /// - An unary operator for a type cannot be found.
334 /// - A binary operator for a combination of types cannot be found.
335 /// - Two different types for \c T and \c F were given with conditional operator <c>Q ? T : F</c>.
336 ///
337 /// For which the scenarios a cast is needed can be determined with field #".Operator" and also by
338 /// checking the number of given arguments.
339 ///
340 /// Built-in compiler plug-in #"plugins::AutoCast" ignores unary operations.
341 /// For binary operations, it just always tries to match both types to the 'major' one. It does
342 /// this, as it is more probable, that for two same types an operator is available.<br>
343 ///
344 /// In contrast to this, a custom plug-in may choose to cast both values to a joint one or to
345 /// any combination of types that it provides an operator for!
346 ///
347 /// Compile-time optimization is supported with auto-casts the same as with other compilation
348 /// mechanics.
349 /// Information about whether the arguments are constants is separately given for the first and
350 /// second argument with fields #".IsConst" and #".RhsIsConst".
351 ///
352 /// Hence, if a plug-in leaves the parent field
353 /// #"CompilationInfo::Callback"
354 /// and/or field #".CallbackRhs"
355 /// \e nulled, but stores a constant cast result value in
356 /// #"CompilationInfo::TypeOrValue"
357 /// and/or #".TypeOrValueRhs",
358 /// then this is detected by the compiler and instead of inserting a cast function call, the
359 /// original constant value is replaced with the returned constant value(s).
360 ///
361 /// If a cast function is compiled (returned with this struct), and the resulting program
362 /// should be duly \e "decompilable", then along with the callback information, a
363 /// compilable expression function name has to be returned in field
364 /// #".ReverseCastFunctionName", respectively #".ReverseCastFunctionNameRhs".
365 /// For further information on this topic see
366 /// #"alib_expressions_details_optimizations_norm"
367 struct CIAutoCast : public CompilationInfo {
368 /// The operator that the cast is required for. If this is <b>'?:'</b> then
369 /// the request is made for conditional operator <c>Q ? T : F</c>. In this case, the
370 /// requirement is to cast both given arguments to the same type - otherwise, the
371 /// conditional operator does not compile!
373
374 /// Input: denotes if the unary argument, respectively the lhs argument of a binary
375 /// operator, is a constant value.
377
378 /// Input: denotes if rhs argument is constant value.
380
381 /// Output: Native C++ callback function to cast the first type with.
382 /// \note
383 /// The optional callback function for casting the left-hand side type is returned with
384 /// inherited field #"CompilationInfo::Callback".
386
387 /// Output: Specifies the return type of #".CallbackRhs", respectively, as the name
388 /// indicates, the result value in case of constant a result.<br>
389 /// In case of constant compile-time values, it might be necessary to allocate
390 /// compile-time memory for the values.
391 /// For this, the field #"CompilationInfo::CompileTimeScope" is to be used.
392 /// \note
393 /// The optional return type and value casting the left-hand side argument is returned with
394 /// inherited field #"CompilationInfo::TypeOrValue".
396
397 /// This is the name of the left-hand side cast function, respectively that of the unary
398 /// argument's cast function, that is used when an expression with auto-cast
399 /// functions is \e decompiled to generate compilable, optimized expression strings.
401
402 /// This is the name of the right-hand side cast function that is inserted when an expression
403 /// with an auto-cast functions is \e decompiled to generate compilable, optimized expression
404 /// strings.
406
407 #if ALIB_DEBUG
408 /// Output: The C++ name of the callback function. This field is available only in debug
409 /// compilations of the library. Hence, setting it must be performed with preprocessor
410 /// conditionals.
412 #endif
413
414 /// Constructor.
415 /// @param scope Passed to parent.
416 /// @param compileTimeAllocator Passed to parent.
417 /// @param op Stored in #".Operator".
418 /// @param isConst Stored in IsConst.
419 /// @param rhsIsConst Stored in RhsIsConst.
420 CIAutoCast( Scope& scope, MonoAllocator& compileTimeAllocator,
421 String& op, bool isConst, bool rhsIsConst )
422 : CompilationInfo ( scope, compileTimeAllocator )
423 , Operator ( op )
424 , IsConst ( isConst )
425 , RhsIsConst ( rhsIsConst )
426 , CallbackRhs ( nullptr )
427 , TypeOrValueRhs ( nullptr ) {}
428 };
429
430 /// Constructor.
431 /// @param name Assigned to field #".Name".
432 /// @param compiler The compiler we will get attached to. Gets stored in field #".Cmplr".
433 /// @param pPriority The priority of this plugin.
434 CompilerPlugin( const NString& name, Compiler& compiler, CompilePriorities pPriority )
435 : Plugin(pPriority)
436 , Name( name )
437 , Cmplr( compiler ) {}
438
439 /// Virtual destructor
440 virtual ~CompilerPlugin() {}
441
442
443 /// Used to compile identifiers (parameterless functions ) and functions parsed from
444 /// expression strings.
445 ///
446 /// The function name is given as an in/out parameter. Implementations might (should) choose to
447 /// - on the one hand allow abbreviations and letter case-insensitive identifier recognitions,
448 /// and
449 /// - consequently return 'corrected' identifier names if an identifier name matched and the
450 /// element got compiled.
451 ///
452 /// Such corrected names will appear in the normalized expression strings returned by
453 /// #"ExpressionVal::GetNormalizedString;*", in case flag
454 /// #"Normalization::ReplaceFunctionNames;*" is set in field
455 /// #"Compiler::CfgNormalization;*".
456 ///
457 /// On success, this method has to provide a (native C++) callback function that accepts
458 /// start and end iterators of boxed arguments which are of the same time as proposed by
459 /// the corresponding iterators found in parameter \p{ciFunction}, along with the return type
460 /// of that function.
461 ///
462 /// Alternatively, if a constant identifier is compiled or if all parameters are known to be
463 /// constant at compile-time, a constant value might be returned.
464 /// For details of the input and output parameters of the function, see struct
465 /// #"CompilerPlugin::CIFunction".
466 ///
467 /// @param[in,out] ciFunction The compilation info struct.
468 /// @return Implementations have to return \c true if the given info struct was filled, or in
469 /// other words, if the plug-in chose to compile the <em>AST</em>-node.<br>
470 /// This default implementation returns \c false to indicate that no compilation
471 /// was done.
472 virtual bool TryCompilation( CIFunction& ciFunction ) { (void) ciFunction; return false; }
473
474 /// Used to compile unary operators parsed from expressions.
475 ///
476 /// On success, this method has to provide a native C++ callback function together with
477 /// a #"alib_expressions_prereq_sb;sample box" that specifies its return type.
478 /// Both are to be stored in output parameter \p{result}.
479 ///
480 /// Alternatively, if field #"%ArgIsConst" of the given compilation info struct is \c true,
481 /// a constant value might be returned.
482 /// For details of the input and output parameters of the function, see struct
483 /// #"CompilerPlugin::CIUnaryOp".
484 ///
485 /// The implementation might allow alias operators. If such alias is found, the used original
486 /// operator should be returned in/out parameter \p{operator}.
487 ///
488 /// Such "corrected" operators will appear in the normalized expression strings returned by
489 /// #"ExpressionVal::GetNormalizedString;*", in case flag
490 /// #"Normalization::ReplaceAliasOperators;*" is set in field
491 /// #"Compiler::CfgNormalization;*".
492 ///
493 /// @param[in,out] ciUnaryOp The compilation info struct.
494 /// @return Implementations have to return \c true if the given info struct was filled, or in
495 /// other words, if the plug-in chose to compile the <em>AST</em>-node.<br>
496 /// This default implementation returns \c false to indicate that no compilation
497 /// was done.
498 virtual bool TryCompilation( CIUnaryOp& ciUnaryOp ) { (void) ciUnaryOp; return false; }
499
500 /// Used to compile binary operators parsed from expressions.
501 ///
502 /// On success, this method has to provide a native C++ callback function together with
503 /// a #"alib_expressions_prereq_sb;sample box" that specifies its return type.
504 /// Both are to be stored in output parameter \p{result}.
505 ///
506 /// Alternatively, depending on fields #"CIBinaryOp::LhsIsConst" and #"CIBinaryOp::RhsIsConst"
507 /// of the given compilation info struct, a constant value might be returned or, as a third
508 /// alternative, field #"%NonConstArgIsResult" may be set to \c true, if an "identity" operator
509 /// is detected.
510 /// For details of the input and output parameters of the function, see struct
511 /// #"CompilerPlugin::CIBinaryOp".
512 ///
513 /// The implementation might allow alias operators. If such alias is found, the used original
514 /// operator should be returned in/out parameter \p{operator}.
515 ///
516 /// Such "corrected" operators will appear in the normalized expression strings returned by
517 /// #"ExpressionVal::GetNormalizedString;*", in case flag
518 /// #"Normalization::ReplaceAliasOperators;*" is set in field
519 /// #"Compiler::CfgNormalization;*".
520 ///
521 ///
522 /// @param[in,out] ciBinaryOp The compilation info struct.
523 /// @return Implementations have to return \c true if the given info struct was filled, or in
524 /// other words, if the plug-in chose to compile the <em>AST</em>-node.<br>
525 /// This default implementation returns \c false to indicate that no compilation
526 /// was done.
527 virtual bool TryCompilation( CIBinaryOp& ciBinaryOp ) { (void) ciBinaryOp; return false; }
528
529 /// Used to provide information to the compiler for casting types.
530 ///
531 /// For details on how this method is overridden, consult the documentation of the input/output
532 /// parameter type #"CompilerPlugin::CIAutoCast".
533 ///
534 ///
535 /// @param[in,out] ciAutoCast The compilation info struct.
536 /// @return Implementations have to return \c true if the given info struct was filled, or in
537 /// other words, if the plug-in chose to provide auto-cast information as requested.<br>
538 /// This default implementation returns \c false to indicate that no compilation
539 /// was done.
540 virtual bool TryCompilation( CIAutoCast& ciAutoCast ) { (void) ciAutoCast; return false; }
541
542};
543
544} // namespace alib[::expressions]
545
546/// Type alias in namespace #"%alib".
548
549} // namespace [alib]
#define ALIB_EXPORT
Box(*)(Scope &scope, ArgIterator argsBegin, ArgIterator argsEnd) CallbackDecl
StdVectorMA< Box >::iterator ArgIterator
Definition alox.cpp:14
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TString< nchar > NString
Type alias in namespace #"%alib".
Definition string.hpp:2174
containers::List< T, MonoAllocator, TRecycling > ListMA
Type alias in namespace #"%alib".
Definition list.hpp:689
boxing::Box Box
Type alias in namespace #"%alib".
Definition box.hpp:1128
strings::TString< character > String
Type alias in namespace #"%alib".
Definition string.hpp:2165
characters::nchar nchar
Type alias in namespace #"%alib".
expressions::CompilerPlugin CompilerPlugin
Type alias in namespace #"%alib".
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace #"%alib".
bool RhsIsConst
Input: denotes if rhs argument is constant value.
CIAutoCast(Scope &scope, MonoAllocator &compileTimeAllocator, String &op, bool isConst, bool rhsIsConst)
CIBinaryOp(Scope &scope, MonoAllocator &compileTimeAllocator, String &op, bool lhsIsConst, bool rhsIsConst)
bool LhsIsConst
Input: Denotes if the lhs-argument is a constant value.
bool NonConstArgIsResult
Output: Used with optimization, see this struct's documentation for more information.
bool RhsIsConst
Input: Denotes if the rhs-argument is a constant value.
String & Operator
Input/Output: The binary operator symbol.
AString & Name
Input: The identifier name to search.
void AddFunctionsWithNonMatchingArguments(const String &signature)
CIFunction(Scope &scope, MonoAllocator &compileTimeAllocator, AString &name, bool isIdentifier, bool argsAreConst, ListMA< String > &hints)
CIUnaryOp(Scope &scope, MonoAllocator &compileTimeAllocator, String &op, bool argIsConst)
String & Operator
Input/Output: The unary operator.
CompilationInfo(Scope &scope, MonoAllocator &allocator)
CallbackDecl Callback
Output: The native C++ callback function to be set by one of the plug-ins.
virtual bool TryCompilation(CIUnaryOp &ciUnaryOp)
virtual bool TryCompilation(CIFunction &ciFunction)
Compiler & Cmplr
The compiler that this plug-in is attached to.
CompilerPlugin(const NString &name, Compiler &compiler, CompilePriorities pPriority)
virtual bool TryCompilation(CIBinaryOp &ciBinaryOp)
virtual ~CompilerPlugin()
Virtual destructor.
virtual bool TryCompilation(CIAutoCast &ciAutoCast)