LangProc / langproc-2021-cw

5 stars 4 forks source link

AST tree #10

Open ljc20 opened 2 years ago

ljc20 commented 2 years ago

Hi I was wondering how we could create the ast statements for functions such as if or else and while ? I have gotten a certain amount of it but would love some clarification. Thank you

ymherklotz commented 2 years ago

So if, else and while are statements, not functions, but yes you can create nodes for each of them in the AST. These could even share some code, because they might have a lot of things in common, in which case you can create a general Statement node that these statements can inherit from.