-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于tokenizer.cpp中的checkToken函数的问题 #9
Comments
没太理解你的问题。
From: Simoncxm <[email protected]>
Date: Sunday, November 17, 2019 at 9:45 PM
To: BUAA-SE-Compiling/miniplc0-compiler <[email protected]>
Cc: Subscribed <[email protected]>
Subject: [BUAA-SE-Compiling/miniplc0-compiler] 关于tokenizer.cpp中的checkToken函数的问题 (#9)
在tokenizer.h中写了需要自己完成这个函数,但指导书中写只能修改nextToken函数。还是只能新增一个辅助函数用来检测其他情况?
―
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#9?email_source=notifications&email_token=AHJULO2XW6UQCZUSDZ5D32TQUFDIFA5CNFSM4JOJ5JE2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HZ3NS4Q>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHJULO2BLWFC4ZQJ24LDN2LQUFDIFANCNFSM4JOJ5JEQ>.
|
checkToken函数显然是应该补充其他情况的,但是指导书中写不能修改这个函数。 |
比如检测一个数字是否越界是否可以也写在checkToken函数中?还是只能新建辅助函数 |
注意 Token 是 immutable 的。
也就是说如果你在 checkToken 内检查如果越界了,那只能重新创建一个新的 Token,从效率上来说不如直接 string 转 int 的时候就存好 int 或者返回错误,但是对于非法的 identifier 不存在这个问题。
这里准确来说是个设计遗留问题,可能的确放开 checkToken 会好一些,我需要一点时间评估一下。
|
See #11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在tokenizer.h中写了需要自己完成这个函数,但指导书中写只能修改nextToken函数。还是只能新增一个辅助函数用来检测其他情况?
The text was updated successfully, but these errors were encountered: