Modify expressions, generated by Antlr?
<p>I would like to read expressions with Antlr4 and the perform some modifications on them. </p>

<p>For example, if grammar is arithmetic, I would modify expression, representing</p>

<pre><code>2 * (3 + 1)
</code></pre>

<p>with</p>

<pre><code>2 * 4
</code></pre>

<p>and then with </p>

<pre><code>8
</code></pre>

<p>This is "calculation" or "simplification". To perform this thing I would create some tree structure and the first idea is to use the very same trees, created by Antlr. </p>

<p>Unfortunately, I don't see any setters for children.</p>

<p>How to accomplish? Should I really duplicate Antlr trees with my own ones for logic of expressions?</p>