This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
Replies: 1 comment
-
需要对函数声明进行 paser |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
在第24个测例,遇到这样的报错:
[24/648] tester/function_test2020/12_getint.sysu.c syntax error|Segmentation fault Traceback (most recent call last): File "/root/sysu/bin/sysu-compiler", line 536, in <module> sys.exit(main(*sys.argv)) File "/root/sysu/bin/sysu-compiler", line 511, in main return unittest_parser(args.unittest, args.clang, File "/root/sysu/bin/sysu-compiler", line 129, in unittest_parser ast1 = json.loads(subprocess.run( File "/usr/lib/python3.9/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
该测例的源码:
#include <sysy/sylib.h> int main(){ int a; a = getint(); return a; }
当我使用命令
/root/sysu/bin/sysu-preprocessor * | clang -cc1 -dump-tokens 2>&1 | /root/sysu/bin/sysu-parser
(*替换为该测例文件名)运行是可以得出该测例的结果的,比对clang结果少了头文件<sysy/sylib.h>中的函数声明。使用命令
cat tmp.sysu.c | ~/sysu/bin/sysu-lexer
发现输出token并不包含#及其后内容,请问这时候需要对引用的头文件中函数如何进行parser分析吗?如果需要的话该如何操作呢?
Beta Was this translation helpful? Give feedback.
All reactions