Professional Documents
Culture Documents
Homework About Principle of Compiler
Homework About Principle of Compiler
begin
end;
解:由题意可知在该段程序中存在的记号(token)有如下:
记号类型 记号名称
Identifiers max, i, j
Operators >, :=
a (a | b)* a
a* b a* b a* b a*
Most Languages are case sensitive, so keywords can be written only one
way, and the regular expressions describing their lexemes are very simple.
However, some languages, like Pascal and SQL, are case in sensitive. For E-
xample, the SQL keyword SELECT can also be written select, Select or sEL-
EcT.
language. Illustrate your idea by writing the expression for SELECT in SQL.
解:1) 首先对于一个关键字丌区分大小写的语言,其关键字的正则表达式可书写如下: