Open bakhtiarZ opened 2 years ago
Yes, the parser is the one that generates the AST. You do that by allocating new nodes wherever they are needed, and otherwise just assigning the pointer that was already constructed by one of the nodes lower down in the parser returned ($$ = $1
).
I wouldn't call it a linked list though, it's just a tree structure, with various different nodes that link to more nodes.
Ok cool so I would have to just make the classes and the grammar hierarchy sorts out the structure of the tree?
On Sat, 12 Mar 2022, 16:38 Yann Herklotz, @.***> wrote:
Yes, the parser is the one that generates the AST. You do that by allocating new nodes wherever they are needed, and otherwise just assigning the pointer that was already constructed by one of the nodes lower down in the parser returned ($$ = $1).
I wouldn't call it a linked list though, it's just a tree structure, with various different nodes that link to more nodes.
— Reply to this email directly, view it on GitHub https://github.com/LangProc/langproc-2021-cw/issues/17#issuecomment-1065914748, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWMTKQFDWZJXCTRXYQUQW4LU7TB6ZANCNFSM5QQKV5EA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
In lab2, we have many classes and derived classes, this seems like a linked list type structure and it is shown to create an AST but I can't find where it does this, like the actual linking of nodes and creation of the tree.
Is it done in the parser where we do things like $$ = $1 ? Is this linking the node to the previous one from the grammar>?