ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
compilerplugin.inl
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/// \emoji :copyright: 2013-2025 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 \b %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/// \b %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 \b %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 \b %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{
92 /// The name of the plug-in. This is used with exception information and with
93 /// #"VirtualMachine::DbgList;program listings" which are available in
94 /// debug-compilations of the library.
96
97 /// The compiler that this plug-in is attached to.
99
100 /// Public inner base struct which provides input and output information for compiling
101 /// single entities (nodes of the \e AST) of a parsed expression.
102 ///
103 /// Descendant types
104 /// - #"CompilerPlugin::CIFunction",
105 /// - #"CompilerPlugin::CIUnaryOp" and
106 /// - #"CompilerPlugin::CIBinaryOp"
107 ///
108 /// extend this struct with input information, specific to the type of <em>AST</em>-node
109 /// currently compiled. Special, descendant type
110 /// - #"CompilerPlugin::CIAutoCast"
111 ///
112 /// in addition adds specific output members.
113 ///
114 /// Together, these four descendants comprise the parameters of the four overloaded methods
115 /// #"CompilerPlugin::TryCompilation(CIUnary)".
117 {
118 /// The scope found here is the same object passed to the method
119 /// #"Compiler::Compile;*", which internally invokes the overloaded methods
120 /// #"CompilerPlugin::TryCompilation(CIFunc);2", that receive an object of this type.
121 ///
122 /// If a compiled expression syntax element evaluates to a constant stored in
123 /// #"TypeOrValue" it has to be ensured that the boxed data is to available during the
124 /// life-cycle of the expression.
125 ///
126 /// To allocate custom compilation data, a custom, derived type, might, for example, be
127 /// extended with simple\c std::vector of pointers to the created objects.
128 /// (Attention: Vectors of value-types must not be used, as with their growth, the objects
129 /// get moved within the heap memory!).<br>.
130 /// Any data allocated, is to be deleted in the virtual destructor of the custom scope type.
132
133 /// An allocator to be used exclusively during compile-time.
134 /// Its memory is cleared (respectively reset to a previous state) after the compilation
135 /// completed.<br>
136 /// (Refers to object #"Compiler::allocator;*".)
138
139 /// Input: A start iterator to #"alib_expressions_prereq_sb;sample boxes"
140 /// that provide the argument types to search a native callback function for.<br>
141 /// In case that descendant classes denote that arguments found in this iterator are
142 /// constant, then the boxes are not just sample boxes, but contain the constant values.
144
145 /// Input: The end iterator to #"ArgsBegin". The expression <c>ArgsEnd - ArgsBegin</c> may be
146 /// used to receive the number of arguments provided.
148
149 #if ALIB_DEBUG
150 /// Output: The C++ name of the callback function. This field is available only in debug
151 /// compilations of the library. Hence, setting it must be performed with preprocessor
152 /// conditionals.
153 const nchar* DbgCallbackName =nullptr;
154 #endif
155
156 /// Output: The native C++ callback function to be set by one of the plug-ins.
158
159 /// Output: Specifies the return type of #".Callback", respectively, as the name indicates, the
160 /// result value in case of constant results.<br>
161 /// Note that in case of constant compile-time values, it might be necessary to allocate
162 /// compile-time memory for the values. For this, field #"CompileTimeScope" is to be used.
163 Box TypeOrValue = nullptr;
164
165
166 /// Constructor.
167 /// @param scope The scope usable for allocation of constant values (compile-time
168 /// allocations). Assigned to field #"CompileTimeScope".
169 /// @param allocator Assigned to field #"CompileTimeAllocator".
170 ///
171 CompilationInfo( Scope& scope, MonoAllocator& allocator )
172 : CompileTimeScope ( scope )
173 , CompileTimeAllocator ( allocator )
174 , ArgsBegin ( scope.Stack->begin())
175 , ArgsEnd ( scope.Stack->end() ) {}
176 };
177
178 /// Info struct for compiling expression identifiers and functions.
179 /// This struct is used with method #"TryCompilation(CIFunction&)" to provide information
180 /// to derived compiler plug-ins, as well as to receive information back.
182 {
183 /// Input: The identifier name to search.
185
186 /// Input: If the function was given as a pure "identifier" this flag is \c true.
187 /// \see See also flag
188 /// #"Compilation::AllowOmittingParenthesesOfParameterlessFunctions" of
189 /// field \see See also #"Compiler::CfgCompilation.;*".
191
192 /// Input: Denotes if all arguments provided are constant values. Operator callbacks that do
193 /// not use context information from the scope, should calculate the then constant result
194 /// and return this value instead of the callback method. (Compile-time optimization.)
196
197 /// A plug-in may add names of functions that matched, while the arguments did not.
198 /// This will be stored in the details of a potential exception, if no other plug-in
199 /// compiles this function and may be displayed to the end-user.
200 ///
201 /// To add entries here, convenience method #"AddFunctionsWithNonMatchingArguments" is
202 /// provided.
204
205 /// Constructor.
206 /// @param scope Passed to parent.
207 /// @param compileTimeAllocator Passed to parent.
208 /// @param name Stored in #Name.
209 /// @param isIdentifier Stored in #IsIdentifier.
210 /// @param argsAreConst Passed to #AllArgsAreConst.
211 /// @param hints Stored in #FunctionsWithNonMatchingArguments.
213 MonoAllocator& compileTimeAllocator,
214 AString& name,
215 bool isIdentifier,
216 bool argsAreConst,
217 ListMA<String>& hints )
218 : CompilationInfo(scope, compileTimeAllocator)
219 , Name (name)
220 , IsIdentifier (isIdentifier)
221 , AllArgsAreConst(argsAreConst)
223
224
225 /// Returns the number of arguments given.
226 /// @return The number of arguments the function call requested.
227 size_t QtyArgs() { return size_t( ArgsEnd - ArgsBegin ); }
228
229 /// Returns the argument number \p{no}.
230 /// @param no The number of the argument requested.
231 /// @return A reference to the requested argument.
232 Box& Arg( size_t no ) { return *(ArgsBegin + static_cast<ptrdiff_t>( no ) ); }
233
234 /// Convenience method that adds creates a monotonically allocated copy of the given string
235 /// and adds it to list #FunctionsWithNonMatchingArguments.
236 ///
237 /// @param signature The function signature to add.
240 };
241
242 /// Info struct for compiling an unary operator.
243 /// This struct is used with method #"TryCompilation(CIUnaryOp&)" to provide information
244 /// to derived compiler plug-ins, as well as to receive information back.
246 {
247 String& Operator; ///< Input/Output: The unary operator.
248
249 /// Input: Denotes if the argument is a constant value. Operator callbacks that do
250 /// not use context information from the scope, should calculate the then constant result
251 /// and return this value instead of the callback method. (Compile-time optimization.)
253
254
255 /// Constructor.
256 /// @param scope Passed to parent.
257 /// @param compileTimeAllocator Passed to parent.
258 /// @param op Stored in #Operator.
259 /// @param argIsConst Passed to field #ArgIsConst.
260 CIUnaryOp( Scope& scope , MonoAllocator& compileTimeAllocator,
261 String& op , bool argIsConst )
262 : CompilationInfo( scope, compileTimeAllocator )
263 , Operator ( op )
264 , ArgIsConst ( argIsConst ) {}
265 };
266
267 /// Info struct for compiling a binary operator.
268 /// This struct is used with method #"TryCompilation(CIBinaryOp&)" to provide information
269 /// to derived compiler plug-ins, as well as to receive information back.
270 ///
271 /// Information about whether the arguments are constants is separately given for \e lhs and
272 /// \e rhs with fields #LhsIsConst and #RhsIsConst.
273 ///
274 /// If both flags evaluate to \c true, operator callback functions that do not use context
275 /// information from the scope (or otherwise rely on external or random data), should calculate
276 /// the - then constant - result at compile-time and return a constant value instead of the
277 /// callback method.
278 ///
279 /// If exactly one of the argument is constant, then some operators might detect further
280 /// possibilities of optimization. Such optimization is operator-specific but goes along the
281 /// lines of the following samples:
282 ///
283 /// term + 0 -> term
284 /// term - 0 -> term
285 /// term * 0 -> 0
286 /// term * 1 -> term
287 /// term / 1 -> term
288 /// term && false -> false
289 /// term && true -> term
290 /// term || true -> true
291 /// term || false -> term
292 ///
293 /// These cases have in common that the result of the operator is either a constant
294 /// or equals the non-constant argument.
295 ///
296 /// In both cases inherited field \c %Callback is to be left \c nullptr. If the result is
297 /// constant, inherited field \b %TypeOrValue is to be set to the constant value.
298 /// In the second case that the non-constant argument equals the result, this can be indicated
299 /// by setting field #NonConstArgIsResult to \c true. In this case, the compiler will choose
300 /// the non-constant argument and drop the other.
301 ///
302 /// \note
303 /// Class #"plugins::Calculus" which specializes this plug-in class,
304 /// provides a convenient way to define the optimization rules described here, along with
305 /// its mechanics to support binary operator compilation.
307 {
308 String& Operator; ///< Input/Output: The binary operator symbol.
309
310 /// Input: Denotes if the lhs-argument is a constant value.
312
313 /// Input: Denotes if the rhs-argument is a constant value.
315
316 /// Output: Used with optimization, see this struct's documentation for more information.
318
319
320 /// Constructor.
321 /// @param scope Passed to parent.
322 /// @param compileTimeAllocator Passed to parent.
323 /// @param op Stored in #Operator.
324 /// @param lhsIsConst Stored in #LhsIsConst.
325 /// @param rhsIsConst Stored in #RhsIsConst.
326 CIBinaryOp( Scope& scope, MonoAllocator& compileTimeAllocator,
327 String& op, bool lhsIsConst, bool rhsIsConst)
328 : CompilationInfo ( scope, compileTimeAllocator )
329 , Operator ( op )
330 , LhsIsConst ( lhsIsConst )
331 , RhsIsConst ( rhsIsConst )
332 , NonConstArgIsResult( false ) {}
333 };
334
335 /// Info struct for compiling automatic type casts. Such automatic cast is tried to be inserted
336 /// into the expression program by the compiler if:
337 ///
338 /// - An unary operator for a type cannot be found.
339 /// - A binary operator for a combination of types cannot be found.
340 /// - Two different types for \c T and \c F were given with conditional operator <c>Q ? T : F</c>.
341 ///
342 /// For which the scenarios a cast is needed can be determined with field #Operator and also by
343 /// checking the number of given arguments.
344 ///
345 /// Built-in compiler plug-in #"plugins::AutoCast" ignores unary operations.
346 /// For binary operations, it just always tries to match both types to the 'major' one. It does
347 /// this, as it is more probable, that for two same types an operator is available.<br>
348 ///
349 /// In contrast to this, a custom plug-in may choose to cast both values to a joint one or to
350 /// any combination of types that it provides an operator for!
351 ///
352 /// Compile-time optimization is supported with auto-casts the same as with other compilation
353 /// mechanics.
354 /// Information about whether the arguments are constants is separately given for the first and
355 /// second argument with fields #IsConst and #RhsIsConst.
356 ///
357 /// Hence, if a plug-in leaves the parent field
358 /// #"CompilationInfo::Callback"
359 /// and/or field #CallbackRhs
360 /// \e nulled, but stores a constant cast result value in
361 /// #"CompilationInfo::TypeOrValue"
362 /// and/or #TypeOrValueRhs,
363 /// then this is detected by the compiler and instead of inserting a cast function call, the
364 /// original constant value is replaced with the returned constant value(s).
365 ///
366 /// If a cast function is compiled (returned with this struct), and the resulting program
367 /// should be duly \e "decompilable", then along with the callback information, a
368 /// compilable expression function name has to be returned in field
369 /// #ReverseCastFunctionName, respectively #ReverseCastFunctionNameRhs.
370 /// For further information on this topic see
371 /// #"alib_expressions_details_optimizations_norm"
373 {
374 /// The operator that the cast is required for. If this is <b>'?:'</b> then
375 /// the request is made for conditional operator <c>Q ? T : F</c>. In this case, the
376 /// requirement is to cast both given arguments to the same type - otherwise, the
377 /// conditional operator does not compile!
379
380 /// Input: denotes if the unary argument, respectively the lhs argument of a binary
381 /// operator, is a constant value.
383
384 /// Input: denotes if rhs argument is constant value.
386
387 /// Output: Native C++ callback function to cast the first type with.
388 /// \note
389 /// The optional callback function for casting the left-hand side type is returned with
390 /// inherited field #"CompilationInfo::Callback".
392
393 /// Output: Specifies the return type of #CallbackRhs, respectively, as the name indicates,
394 /// the result value in case of constant a result.<br>
395 /// In case of constant compile-time values, it might be necessary to allocate
396 /// compile-time memory for the values. For this, field #CompileTimeScope is to be used.
397 /// \note
398 /// The optional return type and value casting the left-hand side argument is returned with
399 /// inherited field #"CompilationInfo::TypeOrValue".
401
402 /// This is the name of the left-hand side cast function, respectively that of the unary
403 /// argument's cast function, that is used when an expression with auto-cast
404 /// functions is \e decompiled to generate compilable, optimized expression strings.
406
407 /// This is the name of the right-hand side cast function that is inserted when an expression
408 /// with an auto-cast functions is \e decompiled to generate compilable, optimized expression
409 /// strings.
411
412 #if ALIB_DEBUG
413 /// Output: The C++ name of the callback function. This field is available only in debug
414 /// compilations of the library. Hence, setting it must be performed with preprocessor
415 /// conditionals.
417 #endif
418
419 /// Constructor.
420 /// @param scope Passed to parent.
421 /// @param compileTimeAllocator Passed to parent.
422 /// @param op Stored in #Operator.
423 /// @param isConst Stored in IsConst.
424 /// @param rhsIsConst Stored in RhsIsConst.
425 CIAutoCast( Scope& scope, MonoAllocator& compileTimeAllocator,
426 String& op, bool isConst, bool rhsIsConst )
427 : CompilationInfo ( scope, compileTimeAllocator )
428 , Operator ( op )
429 , IsConst ( isConst )
430 , RhsIsConst ( rhsIsConst )
431 , CallbackRhs ( nullptr )
432 , TypeOrValueRhs ( nullptr ) {}
433 };
434
435 /// Constructor.
436 /// @param name Assigned to field #Name.
437 /// @param compiler The compiler we will get attached to. Gets stored in field #Cmplr.
438 /// @param pPriority The priority of this plugin.
439 CompilerPlugin( const NString& name, Compiler& compiler, CompilePriorities pPriority )
440 : Plugin(pPriority)
441 , Name( name )
442 , Cmplr( compiler ) {}
443
444 /// Virtual destructor
445 virtual ~CompilerPlugin() {}
446
447
448 /// Used to compile identifiers (parameterless functions ) and functions parsed from
449 /// expression strings.
450 ///
451 /// The function name is given as an in/out parameter. Implementations might (should) choose to
452 /// - on the one hand allow abbreviations and letter case-insensitive identifier recognitions,
453 /// and
454 /// - consequently return 'corrected' identifier names if an identifier name matched and the
455 /// element got compiled.
456 ///
457 /// Such corrected names will appear in the normalized expression strings returned by
458 /// #"ExpressionVal::GetNormalizedString;*", in case flag
459 /// #"Normalization::ReplaceFunctionNames;*" is set in field
460 /// #"Compiler::CfgNormalization;*".
461 ///
462 /// On success, this method has to provide a (native C++) callback function that accepts
463 /// start and end iterators of boxed arguments which are of the same time as proposed by
464 /// the corresponding iterators found in parameter \p{ciFunction}, along with the return type
465 /// of that function.
466 ///
467 /// Alternatively, if a constant identifier is compiled or if all parameters are known to be
468 /// constant at compile-time, a constant value might be returned.
469 /// For details of the input and output parameters of the function, see struct
470 /// #"CompilerPlugin::CIFunction".
471 ///
472 /// @param[in,out] ciFunction The compilation info struct.
473 /// @return Implementations have to return \c true if the given info struct was filled, or in
474 /// other words, if the plug-in chose to compile the <em>AST</em>-node.<br>
475 /// This default implementation returns \c false to indicate that no compilation
476 /// was done.
477 virtual bool TryCompilation( CIFunction& ciFunction ) { (void) ciFunction; return false; }
478
479 /// Used to compile unary operators parsed from expressions.
480 ///
481 /// On success, this method has to provide a native C++ callback function together with
482 /// a #"alib_expressions_prereq_sb;sample box" that specifies its return type.
483 /// Both are to be stored in output parameter \p{result}.
484 ///
485 /// Alternatively, if field \c %ArgIsConst of the given compilation info struct is \c true,
486 /// a constant value might be returned.
487 /// For details of the input and output parameters of the function, see struct
488 /// #"CompilerPlugin::CIUnaryOp".
489 ///
490 /// The implementation might allow alias operators. If such alias is found, the used original
491 /// operator should be returned in/out parameter \p{operator}.
492 ///
493 /// Such "corrected" operators will appear in the normalized expression strings returned by
494 /// #"ExpressionVal::GetNormalizedString;*", in case flag
495 /// #"Normalization::ReplaceAliasOperators;*" is set in field
496 /// #"Compiler::CfgNormalization;*".
497 ///
498 /// @param[in,out] ciUnaryOp The compilation info struct.
499 /// @return Implementations have to return \c true if the given info struct was filled, or in
500 /// other words, if the plug-in chose to compile the <em>AST</em>-node.<br>
501 /// This default implementation returns \c false to indicate that no compilation
502 /// was done.
503 virtual bool TryCompilation( CIUnaryOp& ciUnaryOp ) { (void) ciUnaryOp; return false; }
504
505 /// Used to compile binary operators parsed from expressions.
506 ///
507 /// On success, this method has to provide a native C++ callback function together with
508 /// a #"alib_expressions_prereq_sb;sample box" that specifies its return type.
509 /// Both are to be stored in output parameter \p{result}.
510 ///
511 /// Alternatively, depending on fields \c %LhsIsConst and \c %RhsIsConst of the given compilation
512 /// info struct, a constant value might be returned or, as a third alternative, field
513 /// \c %NonConstArgIsResult may be set to \c true, if an "identity" operator is detected
514 /// For details of the input and output parameters of the function, see struct
515 /// #"CompilerPlugin::CIBinaryOp".
516 ///
517 /// The implementation might allow alias operators. If such alias is found, the used original
518 /// operator should be returned in/out parameter \p{operator}.
519 ///
520 /// Such "corrected" operators will appear in the normalized expression strings returned by
521 /// #"ExpressionVal::GetNormalizedString;*", in case flag
522 /// #"Normalization::ReplaceAliasOperators;*" is set in field
523 /// #"Compiler::CfgNormalization;*".
524 ///
525 ///
526 /// @param[in,out] ciBinaryOp The compilation info struct.
527 /// @return Implementations have to return \c true if the given info struct was filled, or in
528 /// other words, if the plug-in chose to compile the <em>AST</em>-node.<br>
529 /// This default implementation returns \c false to indicate that no compilation
530 /// was done.
531 virtual bool TryCompilation( CIBinaryOp& ciBinaryOp ) { (void) ciBinaryOp; return false; }
532
533 /// Used to provide information to the compiler for casting types.
534 ///
535 /// For details on how this method is overridden, consult the documentation of the input/output
536 /// parameter type #"CompilerPlugin::CIAutoCast".
537 ///
538 ///
539 /// @param[in,out] ciAutoCast The compilation info struct.
540 /// @return Implementations have to return \c true if the given info struct was filled, or in
541 /// other words, if the plug-in chose to provide auto-cast information as requested.<br>
542 /// This default implementation returns \c false to indicate that no compilation
543 /// was done.
544 virtual bool TryCompilation( CIAutoCast& ciAutoCast ) { (void) ciAutoCast; return false; }
545
546};
547
548} // namespace alib[::expressions]
549
550/// Type alias in namespace \b alib.
552
553} // namespace [alib]
#define ALIB_EXPORT
Definition alib.inl:562
Box(*)(Scope &scope, ArgIterator argsBegin, ArgIterator argsEnd) CallbackDecl
StdVectorMA< Box >::iterator ArgIterator
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TString< nchar > NString
Type alias in namespace alib.
Definition string.inl:2181
containers::List< T, MonoAllocator, TRecycling > ListMA
Type alias in namespace alib.
Definition list.inl:697
boxing::Box Box
Type alias in namespace alib.
Definition box.inl:1135
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2172
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)