- 論壇徽章:
- 0
|
*******************************
CHAPTER 15
Grammar Reference
跳到 最后一章 類似復(fù)習(xí)
*******************************
作者可能 編譯器水平非常高,但是 寫作水平 實在 無法恭維。
感覺這本書,重點不突出,很像流水賬。
This chapter is a reference and
summarizes grammar syntax and the key semantics of ANTLR grammars.
其實這章應(yīng)該放在 前面,而且再細(xì)致些。
******************************
15.1 Grammar Lexicon
又 詞法
*****************************
重復(fù)3.jpg (24.51 KB, 下載次數(shù): 53)
下載附件
2014-03-17 13:05 上傳
我為什么說個 又 ?
The lexicon of ANTLR is familiar to most programmers because it follows the
syntax of C and its derivatives with some extensions for grammatical
descriptions.
Comments
There are single-line, multiline, and Javadoc-style comments.
137.JPG (16.12 KB, 下載次數(shù): 57)
下載附件
2014-03-17 13:07 上傳
Identifiers
Token names always start with a capital letter and so do lexer rules as defined
by Java’s Character.isUpperCase() method.
Parser rule names always start with a
lowercase letter (those that fail Character.isUpperCase()).
Literals
All literal strings that are one or more characters in length are
enclosed in single quotes such as ';', 'if', '>=', and '\''
Actions
Actions are code blocks written in the target language.
Keywords
Here’s a list of the reserved words in ANTLR grammars: import, fragment, lexer,
parser, grammar, returns, locals, throws, catch, finally, mode, options, tokens.
|
|