| Liste des Groupes | Revenir à cl c |
On 02/06/2026 14:05, Dan Cross wrote:
You're describing a 'Concrete Syntax Tree' or CST, versus AST.
Although in that case, I expect to see a discrete node for bracketed
expressions (ie. parenthesised), as those would also have a distinct
production in any formal grammar.
Personally I don't have much use for CSTs for a normal compiler, but
they might be useful for source-to-source translators, or programs that
do source refactoring, where you want to preserve extras such as
parentheses even if they're not strictly needed.
(Injecting the right parentheses for examples like `(a + b) * c' which
would have an AST like '(* (+ a b) c)' is surpringly tricky. Easier to
just follow the original source!
>
In any case, that still wouldnt't turn ((a+b)) back into the original;
you'd need a suitable CST.)
Les messages affichés proviennent d'usenet.