ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
compiler.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/// \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8#ifndef HPP_ALIB_EXPRESSIONS_COMPILER
9#define HPP_ALIB_EXPRESSIONS_COMPILER
10#pragma once
12#include "alib/lang/plugins.hpp"
21
22namespace alib { namespace expressions {
23
24// forwards
25namespace detail { struct Parser; }
26struct CompilerPlugin;
27
28//==================================================================================================
29/// An implementation of this abstract interface class may be attached to field
30/// \alib{expressions;Compiler::Repository} to enable an \e automated definition and retrieval
31/// of expression strings of nested expressions.
32///
33/// A default implementation, which uses typical \alib mechanics to define expression
34/// strings, is given with class \alib{expressions;StandardRepository}.
35///
36/// More information about automated nested expressions and the use of this interface class is
37/// provided with manual chapter \ref alib_expressions_nested_config.
38//==================================================================================================
40{
41 public:
42 /// Virtual destructor.
44
45 //==============================================================================================
46 /// This method is called during compilation of expressions in the case a named expression
47 /// is not found by method \alib{expressions;Compiler::GetNamed}.
48 ///
49 /// @param identifier The name of the required expression.
50 /// @param[out] target The target to write the requested expression string to.
51 /// @return \c true, if the expression string could be retrieved, \c false otherwise.
52 /// If \c true is returned and \p{target} is still empty, then the string is defined
53 /// to be empty, which throws an exception on compilation.
54 //==============================================================================================
55 virtual bool Get( const String& identifier, AString& target ) = 0;
56};
57
58//==================================================================================================
59/// This is a central class of library module \alib_expressions_nl used to compile
60/// expression strings.
61///
62/// For information about general use and features of this class consult the
63/// \ref alib::expressions "ALib Expressions User Manual".
64///
65/// ## Friends ##
66/// class \alib{expressions;ExpressionVal}
67//==================================================================================================
68class Compiler : public lang::PluginContainer<CompilerPlugin, CompilePriorities>
69{
70 #if !DOXYGEN
71 friend class ExpressionVal;
72 friend struct detail::Parser;
73 friend class detail::Program;
74 #endif
75
76 public:
77 /// Alias shortcut to the type of the plug-in vector inherited from \b %PluginContainer.
78 using Plugins= std::vector<lang::PluginContainer<CompilerPlugin, CompilePriorities>::Slot>;
79
80 // #############################################################################################
81 // internal fields
82 // #############################################################################################
83 protected:
84 /// Memory for used for permanent allocations during the set-up phase.
85 /// Later it is also used for temporary allocations during compilation and reset to its
86 /// state after setup.
88
89 /// The expression parser.
91
92 /// The map of Type names and bit flag values.
97
98 /// The map of 'named' expressions.
101 std::hash <String>,
102 std::equal_to<String> > namedExpressions;
103
104
105 // #############################################################################################
106 // Public fields
107 // #############################################################################################
108 public:
109
110 /// The list of unary operators.
111 /// To define a new unary operator, method #AddUnaryOperator should be used.
112 /// In debug-builds, the methods asserts that no double insertions are performed.
113 ///
114 /// Custom insertions may be performed before or after invoking #SetupDefaults,
115 /// but before a first expression is compiled.
116 ///
117 ///
118 /// Flag \alib{expressions;Compilation::DefaultUnaryOperators} controls if method
119 /// \b %SetupDefaults adds operators resourced with enumeration
120 /// \alib{expressions;DefaultUnaryOperators}.
122
123 /// This public map allows defining alias names for unary operators. Such names
124 /// must consist only of alphabetic characters.
125 ///
126 /// Flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} controls if method
127 /// #SetupDefaults adds the aliases defined with resourced data records of enumeration
128 /// \alib{expressions;DefaultAlphabeticUnaryOperatorAliases} to this map.
130 String, String,
131 alib::hash_string_ignore_case<character>,
132 alib::equal_to_string_ignore_case<character> > AlphabeticUnaryOperatorAliases;
133
134 /// This public map allows defining alias names for binary operators. Such names
135 /// must consist only of alphabetic characters.
136 ///
137 /// Flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} controls if method
138 /// #SetupDefaults adds the aliases defined with resourced data records of enumeration
139 /// \alib{expressions;DefaultAlphabeticBinaryOperatorAliases} to this map.
141 alib::hash_string_ignore_case<character>,
142 alib::equal_to_string_ignore_case<character> > AlphabeticBinaryOperatorAliases;
143
144 /// Adds an unary operator to this expression compiler.
145 /// This method should be invoked before invoking #SetupDefaults.
146 ///
147 /// Operator symbols must be added only once.
148 ///
149 /// @param symbol The operator symbol.
150 void AddUnaryOperator( const String& symbol )
151 {
152 #if ALIB_DEBUG
153 for( auto& op : UnaryOperators )
154 if( op.Equals<NC>( symbol ) )
155 ALIB_ASSERT_ERROR( false, "EXPR", "Unary operator {!Q'} already defined.", symbol )
156 #endif
157 UnaryOperators.EmplaceBack(symbol);
158 }
159
160
161 /// The list of binary operators. The map stores the precedences.
162 ///
163 /// To define a new binary operator, entry may be added before invoking #SetupDefaults
164 /// using method #AddBinaryOperator.
165 ///
166 /// Flag \alib{expressions;Compilation::DefaultUnaryOperators} controls if method
167 /// \b %SetupDefaults adds operators resourced with enumeration
168 /// \alib{expressions;DefaultBinaryOperators}.
170
171 /// Adds a binary operator to this expression compiler.
172 /// This method should be invoked before invoking #SetupDefaults.
173 ///
174 /// Operator symbols must be added only once.
175 ///
176 /// @param symbol The operator symbol.
177 /// @param precedence The precedence of the operator.
178 void AddBinaryOperator( const String& symbol, int precedence )
179 {
180 ALIB_DBG( auto result= )
181 BinaryOperators.EmplaceOrAssign(symbol, precedence);
182 ALIB_ASSERT_ERROR( result.second == true, "EXPR", // was inserted
183 "Binary operator {!Q'} already defined.", symbol )
184 }
185
186 /// Returns the precedence of given operator \b symbol.
187 ///
188 /// @param symbol The operator symbol.
189 /// @return The precedence of the operator as defined with #AddBinaryOperator.
191 {
192 // search in operator table first
193 auto it= BinaryOperators.Find( symbol );
194 if( it != BinaryOperators.end() )
195 return it.Mapped();
196
197 // have an alias?
198 auto aliasOp= AlphabeticBinaryOperatorAliases.Find( symbol );
199 ALIB_ASSERT_ERROR( aliasOp != AlphabeticBinaryOperatorAliases.end(), "EXPR",
200 "Unknown binary operator {!Q'}.", symbol )
201
202 it= BinaryOperators.Find( aliasOp.Mapped() );
203 ALIB_ASSERT_ERROR( it != BinaryOperators.end(), "EXPR",
204 "Unknown binary operator {!Q'} which was aliased by {!Q'}.",
205 aliasOp->second, symbol )
206 return it.Mapped();
207 }
208
209
210 /// \alib{enums;T_EnumIsBitwise;Bitwise enum class} that lists the plug-ins built-into
211 /// \alib expression library. This bitfield is used with method #SetupDefaults, which
212 /// reads the flags set in #CfgBuiltInPlugins and installs the plug-ins accordingly.
213 enum class BuiltInPlugins
214 {
215 NONE = 0, ///< Installs no plug-in.
216 ALL = -1, ///< Installs all plug-ins.
217 ElvisOperator = (1 << 1), ///< Installs \alib{expressions;plugins::ElvisOperator}.
218 AutoCast = (1 << 2), ///< Installs \alib{expressions;plugins::AutoCast}.
219 Arithmetics = (1 << 3), ///< Installs \alib{expressions;plugins::Arithmetics}.
220 Math = (1 << 4), ///< Installs \alib{expressions;plugins::Math}.
221 Strings = (1 << 5), ///< Installs \alib{expressions;plugins::Strings}.
223 DateAndTime = (1 << 6), ) ///< Installs \alib{expressions;plugins::DateAndTime}. )
224 };
225
226
227 /// Bitfield that defines the built-in compiler plug-ins that are created and inserted
228 /// by method #SetupDefaults.
229 ///
230 /// Defaults to \alib{expressions::Compiler;BuiltInPlugins::ALL}
231 ///
232 /// \note
233 /// The built-in plug-ins are allowed to be shared by different compiler instances.
234 /// To reach that, they must not be disabled here (or method #SetupDefaults must be
235 /// omitted) and instead created once and registered with the compiler using
236 /// inherited method \alib{lang::PluginContainer::InsertPlugin}. In that case, parameter
237 /// \p{responsibility} of that method has to be provided as
238 /// \c Responsibility::KeepWithSender.
240
241 /// The operator defined in this public field is used to address nested expressions.
242 /// The operator used can be customized to any defined (!) unary operator.
243 ///
244 /// To disable nested expression parsing, change to empty or \e nulled string.
245 ///
246 /// \note
247 /// If changed, the change hast to be made \b before invoking #SetupDefaults. Otherwise,
248 /// the default configuration for
249 /// \ref alib_expressions_operators_verbal "verbal operator aliases" would be set in
250 /// effect to a wrong (or disabled) target operator.
251 ///
252 /// Defaults to \c "*".
253 ///
254 /// \see Manual chapter \ref alib_expressions_nested "10. Nested Expressions".
255 ///
257
258 /// Name descriptor for nested expression function.
259 /// Defaults to "Expression" with a minimum abbreviation of \c 4 characters, ignoring letter
260 /// case.<br>
261 /// Resourced with the key \c "EF"
262 ///
263 /// \see Manual chapter \ref alib_expressions_nested "10. Nested Expressions".
265
266 /// Keyword used with optional third parameter of expression function.
267 /// Defaults to \c "throw". Resourced with key \c "EF"
268 ///
269 /// \see Manual chapter \ref alib_expressions_nested "10. Nested Expressions".
271
272 /// Compilation flags.
274
275 /// Flags that allow to tweak the result of the normalization of the originally parsed
276 /// expression string.
278
279 /// This list is used with the normalization of the expression string. It contains
280 /// strings, which are not allowed to appear in normalized expression strings.
281 ///
282 /// In the current library version, such strings might occur only if flags
283 /// \alib{expressions;Normalization::UnaryOpSpace},
284 /// \alib{expressions;Normalization::UnaryOpSpaceIfUnaryFollows} or
285 /// \alib{expressions;Normalization::BinaryOpSpaces} are not set.
286 /// As a sample see expression:
287 ///
288 /// 1 - -2
289 ///
290 /// If no space is written after binary operators, this expression would be normalized
291 /// to:
292 /// 1--2
293 ///
294 /// While this just looks irritating to a homo sapiens, it would be even illegal if
295 /// well known C++ operator <c>--</c> was supported. Therefore, string <c>"--"</c> is added
296 /// to this map in method #SetupDefaults, which forces the normalization logic to insert
297 /// a space, even if spaces are otherwise configured to be omitted.
299
300 /// Formatter used throughout all phases of the life-cycle of an expression:
301 /// - Used for parsing expression strings (Using the encapsulated
302 /// \alib{strings;TNumberFormat;NumberFormat} object. This is also the reason, why the type
303 /// of formatter is \b %Formatter and not its more abstract base \b %Formatter.)
304 /// - Used for the generation of the normalized expression strings.
305 /// - Used for the generation of constant string objects during compilation.
306 /// - Used for the generation of string objects during evaluation.
307 ///
308 /// For the latter two, a copy of the pointer is provided through field
309 /// \doxlinkproblem{structalib_1_1expressions_1_1Scope.html;aebf2cd4ff8a2611de06368fccfd3ef5b;Scope::Formatter;expressions::Scope::Formatter}.
310 /// It is important not to change the formatting parameters in between the creation of the
311 /// compile-time scope and the creation of the evaluation-time scope. If done,
312 /// the expression results could differ when optimizations during compilation are performed.
313 ///
314 /// In the constructor of this class, a \alib{lang::format;Formatter::Clone;clone} of the
315 /// \alib {lang::format::Formatter;Default;default formatter} is copied here.
317
318 /// Optional pointer to a default or custom implementation of a repository that provides
319 /// expression strings for named nested expressions.
320 ///
321 /// \see Manual chapter \ref alib_expressions_nested_config.
323
324 // #############################################################################################
325 // Public Interface
326 // #############################################################################################
327 public:
328 //==========================================================================================
329 /// Constructor. Construction usually is three steps:
330 /// 1. Create class instance
331 /// 2. Set the various configuration options (fields prefixed <c>Cfg</c>).
332 /// 3. Invoke #SetupDefaults.
333 //==========================================================================================
335
336 //==========================================================================================
337 /// Destructor
338 //==========================================================================================
340 virtual ~Compiler();
341
342 //==========================================================================================
343 /// Registers a (custom) type name with this compiler. The name will be used to
344 /// display a type name to end-users, for example, when malformed expressions throw an
345 /// exception.
346 ///
347 /// The built-in types get registered in the constructor of the compiler, where the
348 /// type names are read from the \alib{lang::resources;ResourcePool} of static library object
349 /// \alib{EXPRESSIONS}.
350 ///
351 /// It is recommended that custom plug-ins invoke this method in their constructor.
352 ///
353 /// \note
354 /// There is no general need to register types for using them
355 /// with \alib_expressions_nl. Parameter \p{name} of this method is exclusively
356 /// used to generate textual, human-readable output!
357 ///
358 /// @param sample A \ref alib_expressions_prereq_sb "sample value"
359 /// of the type, which is implicitly boxed when passed.
360 /// @param name The name of the type.
361 //==========================================================================================
363 void AddType(Type sample, const NString& name);
364
365 //==========================================================================================
366 /// Returns the name of the type of the boxed value.
367 /// Note that custom types need to be registered with method #AddType.
368 ///
369 /// If given argument \p{box} is \ref alib_boxing_more_void_void "a void box", the returned
370 /// string is <b>"NONE"</b>.
371 ///
372 /// @param box The box to receive the type name for.
373 /// @return The type name as string.
374 //==========================================================================================
376 NString TypeName(Type box);
377
378 //==========================================================================================
379 /// Writes the signature of a function (as for example found in
380 /// \alib{expressions::plugins;Calculus::FunctionEntry}) to a string buffer.
381 ///
382 /// @param boxArray The start of the array of pointers.
383 /// @param qty The array's length.
384 /// @param target The string to write into.
385 //==========================================================================================
387 void WriteFunctionSignature( Box** boxArray, size_t qty, AString& target );
388
389 //==========================================================================================
390 /// Writes the signature of an argument list to a string buffer.
391 ///
392 /// @param begin Iterator to the first argument.
393 /// @param end End-iterator.
394 /// @param target The string to write into.
395 //==========================================================================================
398 ArgIterator end,
399 AString& target );
400
401 //==========================================================================================
402 /// Completes construction according to configuration options provided with fields
403 /// prefixed <c>Cfg</c>.
404 /// In detail, the following actions are performed:
405 /// - If flag \alib{expressions;Compilation::DefaultUnaryOperators} is set in field
406 /// #CfgCompilation, then
407 /// - the unary operators listed in the \ref alib_enums_records "enum records" of
408 /// \alib{expressions;DefaultUnaryOperators} are added using #AddUnaryOperator.
409 /// - If flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} is set in
410 /// field #CfgCompilation, then the alphabetic alias names found in
411 /// the data records of enumeration
412 /// \alib{expressions;DefaultAlphabeticUnaryOperatorAliases}
413 /// are set in field #AlphabeticUnaryOperatorAliases. (As of the current version this
414 /// is only the token \b NOT aliasing operator <b>"!"</b>.
415 /// - If flag \alib{expressions;Compilation::DefaultBinaryOperators} is set in field
416 /// #CfgCompilation, then
417 /// - the binary operators listed in the data records of enumeration
418 /// \alib{expressions;DefaultBinaryOperators} are added using #AddBinaryOperator.
419 /// - If flag \alib{expressions;Compilation::AllowSubscriptOperator} is not set, the
420 /// subscript operator is omitted.
421 /// - If flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} is set in
422 /// field #CfgCompilation, then the alphabetic alias names found in
423 /// the data records of enumeration
424 /// \alib{expressions;DefaultAlphabeticBinaryOperatorAliases}
425 /// are set in field #AlphabeticBinaryOperatorAliases. (As of the current version this
426 /// is only the token \b NOT aliasing operator <b>"!"</b>.
427 /// - Strings <b>"++"</b> and <b>"--"</b> are added to field #CfgNormalizationDisallowed
428 /// to prevent the unintentional creation of these potential operators in normalizations.
429 /// (This way, a space character will be added between binary <b>"+"</b> and unary
430 /// <b>"+"</b>, respectively binary <b>"-"</b> and unary <b>"-"</b> operators,
431 /// even if the normalization options do not suggest to do this.
432 /// - Depending on the flags set in #CfgBuiltInPlugins, the plug-ins listed in
433 /// enumeration #BuiltInPlugins are created and added.
434 //==========================================================================================
436 void SetupDefaults();
437
438 //==========================================================================================
439 /// Firstly, this method parses the given expression string thereby builds an intermediate
440 /// internal \alib{expressions;detail::AST;abstract syntax tree}.
441 /// This tree is then translated into a \alib{expressions;detail::Program} which evaluates
442 /// the expression in respect to a \alib{expressions;Scope} when executed.
443 ///
444 /// For building the program, attached \alib{expressions;CompilerPlugin} instances
445 /// are queried.
446 ///
447 /// During this process, a \alib{expressions;Normalization;normalized} version of the input
448 /// string is always created. While the original input string can
449 /// be accessed with \alib{expressions;ExpressionVal::GetOriginalString}, the normalized version
450 /// can be retrieved after the compilation with method
451 /// \alib{expressions;ExpressionVal::GetNormalizedString}. During compilation, the normalization
452 /// rules (flags) stored in field #CfgNormalization are applied.
453 ///
454 /// For compilation, a compile-time scope object is created by calling virtual method
455 /// #createCompileTimeScope. If not overwritten, a standard scope object is used.
456 /// If custom callbacks exists that are invokable at compile-time
457 /// (to perform program optimization) and that at the same time rely on custom mechanics
458 /// provided with a custom scope class, then a custom, derived version of this class
459 /// has to be used that overrides method #createCompileTimeScope accordingly.
460 ///
461 /// @param expressionString The string to parse.
462 /// @return A shared pointer to the compiled expression. Contains \c nullptr on failure.
463 //==========================================================================================
464 virtual ALIB_API
465 Expression Compile( const String& expressionString );
466
467 //==========================================================================================
468 /// Compiles the given \p{expressionString} and adds a compiled expression to the map of
469 /// named expressions.
470 ///
471 /// @param name The name used to map the expression.
472 /// @param expressionString The string to parse.
473 /// If nulled, entry \p{name} is removed (if existing).
474 /// @return \c true if an expression with the same named existed and was replaced.
475 /// Otherwise, returns \c false.
476 //==========================================================================================
477 virtual ALIB_API
478 bool AddNamed( const String& name, const String& expressionString );
479
480 //==========================================================================================
481 /// Removes a named expression. This is just a shortcut to #AddNamed, providing
482 /// a nulled string for parameter \p{expressionString}.
483 ///
484 /// @param name The name of the expression to be removed.
485 /// @return \c true if an expression with the given name existed and was removed.
486 /// Otherwise, returns \c false.
487 //==========================================================================================
488 bool RemoveNamed( const String& name )
489 {
490 return AddNamed( name, NULL_STRING );
491 }
492
493 //==========================================================================================
494 /// Returns a named expression previously defined using #AddNamed.
495 /// In the case that no expression with the given \p{name} was defined and optional interface
496 /// #Repository is set, then this interface is used to retrieve a corresponding expression
497 /// string and compile the named expression 'on the fly'.
498 ///
499 /// \see
500 /// Manual chapter \ref alib_expressions_nested_config.
501 ///
502 /// @param name The name of the expression.
503 /// @return In case of success a shared pointer to the expression.
504 //==========================================================================================
505 virtual ALIB_API
506 Expression GetNamed( const String& name );
507
508 /// Provides access to the internal \alib{MonoAllocator}.
509 /// \note This method is deemed non-standard use of this class and the using code needs to
510 /// knowing what to do.
511 /// @return The internal monotonous allocator.
513
514 // #############################################################################################
515 // Protected Interface
516 // #############################################################################################
517 protected:
518 //==========================================================================================
519 /// This virtual method is called by #Compile to create the scope object used
520 /// for allocations that are made for intermediate results at compile-time.
521 ///
522 /// Compile-time allocations occur when expression terms that use purely constant arguments
523 /// are evaluated at compile-time. Such optimization consequently leads to the invocation
524 /// of callback functions at compile-time.
525 ///
526 /// If now, custom callback functions rely on custom allocation mechanics, provided with
527 /// custom scope types, then this method has to be overridden to return such a custom
528 /// scope object.
529 ///
530 /// @param expressionAllocator The allocator of the expression used to allocate the
531 /// compile-time scope.
532 /// @return The default implementation returns the standard scope object.
533 /// For its construction, the field #CfgFormatter is provided.<br>
534 /// Derived compilers may need to return a scope object of a derived type.
535 //==========================================================================================
536 virtual ALIB_API
537 Scope* createCompileTimeScope(MonoAllocator& expressionAllocator);
538
539 //==========================================================================================
540 /// Implements \alib{expressions;ExpressionVal::GetOptimizedString}.
541 ///
542 /// @param expression the expression to generate an optimized string for.
543 //==========================================================================================
546};
547
548
549} // namespace alib[::expressions]
550
551DOX_MARKER([DOX_MANUAL_ALIASES_COMPILER])
552/// Type alias in namespace \b alib.
553using Compiler= expressions::Compiler;
554
555} // namespace [alib]
556DOX_MARKER([DOX_MANUAL_ALIASES_COMPILER])
557
558ALIB_ENUMS_MAKE_BITWISE(alib::expressions::Compiler::BuiltInPlugins)
559
560
561#endif // HPP_ALIB_EXPRESSIONS_COMPILER
562
void AddBinaryOperator(const String &symbol, int precedence)
Definition compiler.hpp:178
HashMap< MonoAllocator, String, String, alib::hash_string_ignore_case< character >, alib::equal_to_string_ignore_case< character > > AlphabeticUnaryOperatorAliases
Definition compiler.hpp:132
virtual ALIB_API Expression Compile(const String &expressionString)
Definition compiler.cpp:242
StringVectorMA CfgNormalizationDisallowed
Definition compiler.hpp:298
std::vector< lang::PluginContainer< CompilerPlugin, CompilePriorities >::Slot > Plugins
Alias shortcut to the type of the plug-in vector inherited from PluginContainer.
Definition compiler.hpp:78
HashMap< MonoAllocator, String, String, alib::hash_string_ignore_case< character >, alib::equal_to_string_ignore_case< character > > AlphabeticBinaryOperatorAliases
Definition compiler.hpp:142
ALIB_API NString TypeName(Type box)
Definition compiler.cpp:434
ExpressionRepository * Repository
Definition compiler.hpp:322
HashMap< MonoAllocator, String, int > BinaryOperators
Definition compiler.hpp:169
List< MonoAllocator, String > UnaryOperators
Definition compiler.hpp:121
int GetBinaryOperatorPrecedence(const String &symbol)
Definition compiler.hpp:190
HashMap< MonoAllocator, TypeFunctors::Key, NAString, TypeFunctors::Hash, TypeFunctors::EqualTo > typeMap
The map of Type names and bit flag values.
Definition compiler.hpp:96
ALIB_API void AddType(Type sample, const NString &name)
Definition compiler.cpp:426
ALIB_API void getOptimizedExpressionString(ExpressionVal &expression)
Definition compiler.cpp:330
bool RemoveNamed(const String &name)
Definition compiler.hpp:488
HashMap< MonoAllocator, AString, Expression, std::hash< String >, std::equal_to< String > > namedExpressions
The map of 'named' expressions.
Definition compiler.hpp:102
Compilation CfgCompilation
Compilation flags.
Definition compiler.hpp:273
strings::util::Token CfgNestedExpressionFunction
Definition compiler.hpp:264
detail::Parser * parser
The expression parser.
Definition compiler.hpp:90
virtual ALIB_API bool AddNamed(const String &name, const String &expressionString)
Definition compiler.cpp:358
MonoAllocator & GetAllocator()
Definition compiler.hpp:512
Normalization CfgNormalization
Definition compiler.hpp:277
ALIB_API void WriteFunctionSignature(Box **boxArray, size_t qty, AString &target)
Definition compiler.cpp:450
ALIB_API void SetupDefaults()
Definition compiler.cpp:163
virtual ALIB_API ~Compiler()
Destructor.
Definition compiler.cpp:151
@ AutoCast
Installs plugins::AutoCast.
@ IF_ALIB_CAMP
Installs plugins::DateAndTime. )
@ Arithmetics
Installs plugins::Arithmetics.
@ Strings
Installs plugins::Strings.
@ ElvisOperator
Installs plugins::ElvisOperator.
virtual ALIB_API Scope * createCompileTimeScope(MonoAllocator &expressionAllocator)
Definition compiler.cpp:157
BuiltInPlugins CfgBuiltInPlugins
Definition compiler.hpp:239
virtual ALIB_API Expression GetNamed(const String &name)
Definition compiler.cpp:392
void AddUnaryOperator(const String &symbol)
Definition compiler.hpp:150
virtual bool Get(const String &identifier, AString &target)=0
virtual ~ExpressionRepository()
Virtual destructor.
Definition compiler.hpp:43
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
Definition bitwise.hpp:109
#define A_CHAR(STR)
#define ALIB_API
Definition alib.hpp:639
#define ALIB_ASSERT_ERROR(cond,...)
Definition alib.hpp:1271
#define ALIB_DBG(...)
Definition alib.hpp:390
StdVectorMono< Box >::iterator ArgIterator
@ DateAndTime
Collection of date and time functions based on alib::time.
Definition alib.cpp:69
expressions::Expression Expression
Type alias in namespace alib.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TString< character > String
Type alias in namespace alib.
constexpr String NULL_STRING
A nulled string of the default character type.
Definition string.hpp:2549
Comparison functor for type const std::type_info*.
Hash code functor for type const std::type_info*.
const ::std::type_info * Key
The key type.
This detail class constitutes an abstract base class for expression parsers.
Definition parser.hpp:24