Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

请问parser实验是否需要考虑局部变量呢? #28

Answered by wu-kan
zjnyly asked this question in Q&A
Discussion options

You must be logged in to vote

parser 实验只关心语法树的生成,不关注语义是否正确,只要和 clang 构造的语法树有相同结构即视为通过,语义可以在下一个 generator 实验中检查。换句话说,type 不是这个实验的必选项。

如果你希望通过 parser-2 等评测项,可以在 yyparse 函数执行完后再重新遍历整棵构造出的树,给每个节点补充额外的信息。

PS:目前 SYsU 语法与 SysY-2021 语法保持一致,不包含 double 类型。不过 SysY-2022 语法中增加了 float 类型,我已经加入头文件 sysy/sylib.h,可以通过宏 #define __SYSY 202203L 开启,如果想增加语法支持可以从这里入手:)这部分或许会作为明年实验的要求。

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zjnyly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants