Introduction
Welcome to the release of
Expression parser version 1x7.
This is going to be a short thread as all the necessary information can be found in my other threads created about
ep, they can be seen at the bottom of this page.
What is Expression Parser?
Ep, which by the way is short for
Expression Parser, is a new scripting language created for the sole purpose of being used by MPGH members exclusively. It's meant to work along the side of C++, meaning you can directly use
ep in your C++ Applications by simply including the
ep headers and libraries. The now improved C++ portability means you can have
ep arguments (
variable_list) automatically deduced into arguments at C++ compile time.
I wanna learn more, how does it work?
Expression Parser Theoretical Introduction
Expression Parser Practical and Syntactical Introduction
Changelog
Version 1x2
Version 1x3
Code:
- You can now include files with the import keyword, by simply using "" operator.
Example:
import "myfile.ep";
- Cleaned up some module code.
- Fixed a logical error inside of the optimizer.
(It optimized correctly, but after said optimization the cursor would be at the wrong position)
- Fixed bug in the engine constructor leading to undefined behaviour.
- Fixed fake conversion bug in ostream::put and ostream::putln.
(It would always throw a conversion error)
Version 1x4
Code:
- Fixed another optmization bug where dead code optmization would only remove the first type of dead code.
e.g:
5 + 5;
6 + 5;
would optimize to:
6 +5;
when really there should be no blocks left.
- Added plugins (aka import modules)
Recommended usage:
use function ep::load_plugins to load multiple plugins at once (e.g ep::module( ep::load_plugins( "v1", "v2" )))
A plugin must contain the following functions:
exern "C" __declspec(dllexport) void load_plugin( dispatch_engine_ptr );
exern "C" __declspec(dllexport) const char *get_name( );
- FINALLY FIXED OPERATOR -> GLITCHES, YOU CAN NOW USE IT HOWEVER THE
YOU DESIRE. FK YEA.
Version 1x5
Code:
- Fixed another bug with the '->' operator
Example:
x()->y()->z()
Wouldn't work, because the interpreter only considered
value references from lvalue's, hence the above expression
would be undefined behavour. (Would most like throw "invalid -> usage")
- Added the 'make_method' operator, it processes and makes a ep::method_ptr from a
c++ callable.
- Added some C++ compile time error messages.
- Fixed a value reference bug:
Previous to 1x5 the following C++ function:
type *get_self_ptr( )
{
return this;
};
"get_self_ptr",
[]( type *obj )
{
return std::make_shared<ep::value_reference>( obj->get_self_ptr( ),
engine->get_type_info( "" ) );
};
And if you then added that member method onto the type "type",
and do this in ep:
auto test = type(); // Construct..
test->get_self_ptr(); // call...
// Now 'test' has been destructed. Because
// the rvalue of 'get_self_ptr' is destructed
// at the end of the expression.
which is why I added the possibilty to determine if a value_reference should be destructed,
simply pass another argument to the constructor of value_reference of type bool,
you only need to specify it if it's not supposed to be destructed, it is default true.
"get_self_ptr",
[]( type *obj )
{
return std::make_shared<ep::value_reference>( obj->get_self_ptr( ),
engine->get_type_info( "" ),
false ); // don't destruct.
};
Version 1x6
Code:
- Added a few new keywords:
group
members
methods
public (W.I.P They have no meaning yet)
private (W.I.P They have no meaning yet)
- Improved some error messages
- Fixed reference bug
(Assigning a variable that was a reference never changed the original reference, only swapped them)
- New syntax rules:
following a method keyword can now have it's identifier defined within single quotes. (')
Example:
method 'x'();
It's meant to be used for operators in groups, such as:
method '='( &other )
{
x_ = other->x_;
y_ = other->y_;
};
- Fixed internal tokenizer error (' character threw an unrecognized sequence error)
- Added the following operators to internal types (integral, floating, string_literal):
'=' operator;
- Added feature to dispatch_state allowing a this ptr to be recognized through
it's arguments, and as such can later be used when looking for a variable.
note that the following example will not throw an error, but instead
the X()'s local 'x_' is implicitly selected, instead of X's 'x_' member:
group X
{
members;
var x_;
methods:
X( &x )
{
var x_;
x_ = x; // use this->x_ for explicit usage
};
method print()
{
cout << x_ << endl;
};
};
auto x = X( 10 ); // X::x_ is left unchanged, as you are implicitly selecting the local variable
// x_ instead, be careful about this!
x->print( );
Output:
undefined behaviour or 0 (depending on implementation, as you never initalize x_)
Firstly, note that, this is the intended implementation, this is not a logical error,
but instead a logical feature. No errors should arise as long as you learn the proper
usage.
Secondly, as aforementioned; the same rules apply to global vs local scope.
- Also important to note, when a group is created only the clone, constrctor, and destructor
may be automatically emitted, any operators (such '=') must always be explicitly defined.
- Since this wasn't actually around previously, enabled the access of member variables with
'->' operator, however only if their storage flag is 'public' (W.I.P).
Version 1x7
Code:
- Added a few new working keywords (means they're implemented)
break
continue
public
private
- Added the ability for a developer to specift if an argument should be a ep reference
(using the automatic deduction method) specify your argument as ep::argument_ref_ptr.
- Added implementation of binary files (use epcc to compile your *.ep file into a *.oep)
- Huge improvements/bug fixes to asignments (before you couldn't do object->x = 5, or get_x() = 5)
you can now! Yay.
@
Hunter or @
Hugo Boss
Sincerely,
Yamiez.