Koning Van Worcester 👑️ on Nostr: A glass of 🍷️ and an hour later, I implemented alias expressions in my compiler ...
A glass of 🍷️ and an hour later, I implemented alias expressions in my compiler :)
For example:
```
alias expr = 1+1;
int main()
{
int i = expr;
return i;
}
```
And running `./tlang.out; echo $?` you get `2` as expected.
---
The MetaProcessor searches for all VariableExpression(s) (which `expr` would be in `int i = expr;`) and then clones the alias's expression and replaces the AST node with a clone of itself.
For example:
```
alias expr = 1+1;
int main()
{
int i = expr;
return i;
}
```
And running `./tlang.out; echo $?` you get `2` as expected.
---
The MetaProcessor searches for all VariableExpression(s) (which `expr` would be in `int i = expr;`) and then clones the alias's expression and replaces the AST node with a clone of itself.