⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 复件 example.xlex

📁 词法分析器
💻 XLEX
字号:
    //注释测试
/*关键字定义*/
[Keyword_begin] //注释测试
	/*所有关键字每个一行,不能有多余字符*/
	main
	if
	while
	for
	break
	continue
	return
	int
	float
	double
	char
	short
	switch
	case
	default
	string
	read
	write
[Keyword_end]

[Symbol_begin]
~
!
@
%
^
&
\*
\(
\)
-
+
\=
\{
\}
\[
\]
:
;
"
'
\|
\\
<
>
,
.
?
/
<=
>=
==
!=
[Symbol_end]


[type_begin]
	/*
		新的token类型定义
		最好用大写
	*/
	NUM
	FLOATNUM
	CONSTSTRING
	ID		//变量、函数等名称
	NOTATION
	BLANK
[type_end]

[Regular_begin]
	digit	= [0-9]
	letter	= [a-zA-Z]
	all	= [#-~]|\s|!		// \s 为空格
	name_c	= [a-zA-Z]|_
[Regular_end]

[lex_begin]
{digit}{digit}* | -{digit}{digit}*
NUM

{digit}*.{digit}{digit}* | -{digit}*.{digit}{digit}*
FLOATNUM

" {all}* "
CONSTSTRING

{name_c}  ({name_c} | {digit})*
ID

\/ \/  {all}* (\n|\n\r)
NOTATION

(\n | \s | \t | \r)(\n | \s | \t | \r)*		//回车 或者 空格 或者TAB
BLANK
[lex_end]

[nonterminal_begin]
a
b
c
d
e

[nonterminal_end]

[grammer_begin]
a = [b][c]

b = [c][d]

c = [a]

d = <if>

e = <if>

[grammer_end]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -