summaryrefslogtreecommitdiff
path: root/src/cmd/goyacc/doc.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-04-20 15:44:41 +0200
committerOndřej Surý <ondrej@sury.org>2011-04-20 15:44:41 +0200
commit50104cc32a498f7517a51c8dc93106c51c7a54b4 (patch)
tree47af80be259cc7c45d0eaec7d42e61fa38c8e4fb /src/cmd/goyacc/doc.go
parentc072558b90f1bbedc2022b0f30c8b1ac4712538e (diff)
downloadgolang-upstream/2011.03.07.1.tar.gz
Imported Upstream version 2011.03.07.1upstream/2011.03.07.1
Diffstat (limited to 'src/cmd/goyacc/doc.go')
-rw-r--r--src/cmd/goyacc/doc.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cmd/goyacc/doc.go b/src/cmd/goyacc/doc.go
index 686f75745..5dd6abe69 100644
--- a/src/cmd/goyacc/doc.go
+++ b/src/cmd/goyacc/doc.go
@@ -17,7 +17,8 @@ Yacc adepts will have no trouble adapting to this form of the tool.
The file units.y in this directory is a yacc grammar for a version of
the Unix tool units, also written in Go and largely transliterated
-from the Plan 9 C version.
+from the Plan 9 C version. It needs the flag "-p units_" (see
+below).
The generated parser is reentrant. Parse expects to be given an
argument that conforms to the following interface:
@@ -31,8 +32,15 @@ Lex should return the token identifier, and place other token
information in lval (which replaces the usual yylval).
Error is equivalent to yyerror in the original yacc.
-Code inside the parser may refer to the variable yylex
+Code inside the parser may refer to the variable yylex,
which holds the yyLexer passed to Parse.
+Multiple grammars compiled into a single program should be placed in
+distinct packages. If that is impossible, the "-p prefix" flag to
+goyacc sets the prefix, by default yy, that begins the names of
+symbols, including types, the parser, and the lexer, generated and
+referenced by goyacc's generated code. Setting it to distinct values
+allows multiple grammars to be placed in a single package.
+
*/
package documentation