Skip to content

Commit 3f3ba25

Browse files
authored
Merge pull request #157 from akimd/master
Fixes in the documentation
2 parents e0d9c1a + 4078046 commit 3f3ba25

File tree

2 files changed

+28
-32
lines changed

2 files changed

+28
-32
lines changed

README.rdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
Any kind of bug report is welcome.
7777
If you find a bug of Racc, please email me. Your grammar file,
78-
debug output genereted by "racc -g", are helpful.
78+
debug output generated by "racc -g", are helpful.
7979

8080

8181
Minero Aoki

rdoc/en/grammar.en.rdoc

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@
44

55
== Class Block and User Code Block
66

7-
There's two block on toplevel.
8-
one is 'class' block, another is 'user code' block. 'user code' block MUST
9-
places after 'class' block.
7+
There are two top-level blocks: the 'class' block, and the 'user code'
8+
block. The 'user code' block MUST be after the 'class' block.
109

1110
== Comment
1211

13-
You can insert comment about all places. Two style comment can be used,
14-
Ruby style (#.....) and C style (/*......*/) .
12+
Comments can be added about everywhere. Two comment styles are
13+
supported: Ruby style (`# ...`) and C style (`/* ... */`).
1514

1615
== Class Block
1716

1817
The class block is formed like this:
1918
--
2019
class CLASS_NAME
21-
[precedance table]
22-
[token declearations]
20+
[precedence table]
21+
[token declarations]
2322
[expected number of S/R conflict]
2423
[options]
25-
[semantic value convertion]
24+
[semantic value conversion]
2625
[start rule]
2726
rule
2827
GRAMMARS
@@ -43,7 +42,7 @@ end
4342

4443
== Grammar Block
4544

46-
The grammar block discripts grammar which is able
45+
The grammar block describes the grammar
4746
to be understood by parser. Syntax is:
4847
--
4948
(token): (token) (token) (token).... (action)
@@ -69,7 +68,7 @@ It is value of result, or returned value by "return" statement.
6968
Here is an example of whole grammar block.
7069
--
7170
rule
72-
goal: definition ruls source { result = val }
71+
goal: definition rules source { result = val }
7372

7473
definition: /* none */ { result = [] }
7574
| definition startdesig { result[0] = val[1] }
@@ -96,7 +95,7 @@ An array of value of right-hand side (rhs).
9695
A stack of values.
9796
DO NOT MODIFY this stack unless you know what you are doing.
9897

99-
== Operator Precedance
98+
== Operator Precedence
10099

101100
This function is equal to '%prec' in yacc.
102101
To designate this block:
@@ -128,25 +127,24 @@ rule
128127

129128
== expect
130129

131-
Racc has bison's "expect" directive.
130+
Racc supports Bison's "expect" directive to declare the expected
131+
number of shift/reduce conflicts.
132132
--
133-
# Example
134-
135133
class MyParser
136134
rule
137135
expect 3
138136
:
139137
:
140138
--
141-
This directive declears "expected" number of shift/reduce conflict.
142-
If "expected" number is equal to real number of conflicts,
143-
racc does not print confliction warning message.
139+
Then warnings are issued only when the effective number of conflicts differs.
140+
144141

145142
== Declaring Tokens
146143

147-
By declaring tokens, you can avoid many meanless bugs.
148-
If decleared token does not exist/existing token does not decleared,
149-
Racc output warnings. Declearation syntax is:
144+
Declaring tokens avoids many bugs.
145+
146+
Racc outputs warnings for declared tokens that do not exist, or existing tokens not declared.
147+
The syntax is:
150148
--
151149
token TOKEN_NAME AND_IS_THIS
152150
ALSO_THIS_IS AGAIN_AND_AGAIN THIS_IS_LAST
@@ -174,12 +172,12 @@ You can use 'no_' prefix to invert its meanings.
174172

175173
Token symbols are, as default,
176174

177-
* naked token string in racc file (TOK, XFILE, this_is_token, ...)
175+
* naked token strings in racc file (TOK, XFILE, this_is_token, ...)
178176
--> symbol (:TOK, :XFILE, :this_is_token, ...)
179-
* quoted string (':', '.', '(', ...)
177+
* quoted strings (':', '.', '(', ...)
180178
--> same string (':', '.', '(', ...)
181179

182-
You can change this default by "convert" block.
180+
You can change this default using a "convert" block.
183181
Here is an example:
184182
--
185183
convert
@@ -202,18 +200,19 @@ end
202200

203201
== Start Rule
204202

205-
'%start' in yacc. This changes start rule.
203+
'%start' in yacc. This changes the start symbol.
206204
--
207205
start real_target
208206
--
209-
This statement will not be used forever, I think.
207+
210208

211209
== User Code Block
212210

213-
"User Code Block" is a Ruby source code which is copied to output.
214-
There are three user code block, "header" "inner" and "footer".
211+
A "User Code Block" is a piece of Ruby source code copied in the output.
212+
There are three user code blocks, "header" "inner" and "footer".
215213

216-
Format of user code is like this:
214+
User code blocks are introduced by four '-' at the beginning of a line,
215+
followed by a single-word name:
217216
--
218217
---- header
219218
ruby statement
@@ -225,6 +224,3 @@ Format of user code is like this:
225224
:
226225
:
227226
--
228-
If four '-' exist on line head,
229-
racc treat it as beginning of user code block.
230-
A name of user code must be one word.

0 commit comments

Comments
 (0)