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

设计一个RE和FA 来识别程序中代码的两段不连续的双引号 #30

Open
Levinethan opened this issue Dec 29, 2020 · 2 comments

Comments

@Levinethan
Copy link

Levinethan commented Dec 29, 2020

在PL/I中,通过在一行连续写两个引号,可以向字符串中插入一个引号字符。因而下诉字符串
The code, " , should be typed
在PL/I中将写作
"The code," ",should be typed"

这道题是《编译设计》中第二章的一道题,我应该怎样设计RE和FA来识别?假定字符串以引号开始和结束,只包含取字字母表集中的符号。

@Levinethan
Copy link
Author

Levinethan commented Dec 29, 2020

@lazyparser
Copy link
Owner

如果是要在词法识别的时候识别引号字符串,那么在FA上也需要吃进去(吧)?

可以用 flex 写几行测试下。

另外如果是确定的 '' 根据程序的要求有可能有更简单的方法直接匹配字面量。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants