帮我 做一个词法编译器(有要求)

来源:百度知道 编辑:UC知道 时间:2024/06/30 13:14:34
The lexical structure of this toy programming language is defined as follows:

• comments: Comments starts with // characters and ends with the end of line
character.
• keywords: The keywords given in the grammar:
int double if then else while for
• identifiers: An identifier starts with a letter and continues with a letter or digit. A
keyword cannot be an identifier, and the maximum length of an identifier is 32 characters.
• operators: The followings are operators:
+ - / * = == < <= > >= !=
• delimiters: The followings are delimiters: ( ) { } ;
• numbers: The numbers are defined as follows:
digit  0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
intnumber  digit+ (the maximum integer number is 231)
exponent  E ( + | - |  ) digit+ (the maximum exponent value is

哈哈,这个有难度,正好我这两天的作业就是做这个,刚做出来,不过没你这么难的,符号少很多,和你要求的难度差的挺远。

哈哈,敢情现在作业都用百度知道做啊
用javacc,我就说这么多

???