📄 ebnf.atg
字号:
COMPILER EBNF
(*
-- Attribute grammar for simple EBNF cross reference generator
-- P.D. Terry, Rhodes University, January 1992
*)
FROM CrossRef IMPORT Create, Add, List, TABLES, Table;
CONST
applied = FALSE;
defined = TRUE;
VAR
Name : ARRAY [0 .. 25] OF CHAR;
CHARACTERS
letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
lowline = "_".
digit = "0123456789".
noquote1 = ANY - "'".
noquote2 = ANY - '"'.
IGNORE CHR(9) .. CHR(13)
COMMENTS FROM "(*" TO "*)" NESTED
TOKENS
nonterminal = letter {letter | lowline | digit} .
terminal = "'" noquote1 {noquote1} "'" | '"' noquote2 {noquote2} '"' .
PRODUCTIONS
EBNF = (. Create(Table) .)
{ Production } EOF .
Production =
SYNC nonterminal (. LexString(Name);
Add(Table, Name, EBNFS.line, defined) .)
WEAK "=" Expression SYNC "." .
Expression = Term { WEAK "|" Term } .
Term = Factor { Factor } .
Factor =
nonterminal (. LexString(Name);
Add(Table, Name, EBNFS.line, applied) .)
| terminal
| "[" Expression "]"
| "(" Expression ")"
| "{" Expression "}" .
END EBNF.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -