Sujet : Re: Top 10 most common hard skills listed on resumes...
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.cDate : 01. Sep 2024, 14:30:21
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <865xrftsb6.fsf@linuxsc.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Bart <
bc@freeuk.com> writes:
On 31/08/2024 23:10, Tim Rentsch wrote:
>
Bart <bc@freeuk.com> writes:
[...]
Given this:
>
x + y = z;
(x + y) = z;
>
My compiler produces the same AST for the LHS of '=' in both
cases.
>
To understand why they are different, try drawing parse trees
rather than abstract syntax trees.
>
https://en.wikipedia.org/wiki/Parse_tree
>
Yeah, the CST differs in retaining the parentheses. But I can
already see that from the source code.
>
For normal compilation, that information is redundant.
The parse trees are different in a lot more ways than whether
one keeps parentheses. But the point is to compare the parse
tree for x + y = z to the abstract syntax tree for x + y = z.
Among other things, the input x + y = z doesn't even have a
parse tree; the rules governing the formation of parse trees
don't allow any parse tree matching that entire input.