Split Expressions into separate Statements
I'm trying to extend expressions for a new data type. The calculation of the Expressions like the PlusExpression should be done by an external library.
This means for a statement like
mytype a = b + c * d
I would need to to transform the AST to something like:
mytype t1;
library_multi(c, d, t1);
mytype t2;
library_add(b, t1, t2);
mytype a;
library_copy(t2, a)
So I would have to insert new statements for each expression into the statementlist above the Variable Declaration statement.
I can't use objects since I'm trying to do this in mbeddr c.
What would be a good approach to do this? (or is this even a good idea?)
Please sign in to leave a comment.