fix the buggy parser example in the Genlex documentation (issue reported by Armael Geneau)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13613 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
35d1dde122
commit
c089c9a6dd
|
@ -27,13 +27,14 @@
|
|||
to, for instance, [int], and would have rules such as:
|
||||
|
||||
{[
|
||||
let parse_expr = parser
|
||||
[< 'Int n >] -> n
|
||||
| [< 'Kwd "("; n = parse_expr; 'Kwd ")" >] -> n
|
||||
| [< n1 = parse_expr; n2 = parse_remainder n1 >] -> n2
|
||||
let rec parse_expr = parser
|
||||
| [< n1 = parse_atom; n2 = parse_remainder n1 >] -> n2
|
||||
and parse_atom = parser
|
||||
| [< 'Int n >] -> n
|
||||
| [< 'Kwd "("; n = parse_expr; 'Kwd ")" >] -> n
|
||||
and parse_remainder n1 = parser
|
||||
[< 'Kwd "+"; n2 = parse_expr >] -> n1+n2
|
||||
| ...
|
||||
| [< 'Kwd "+"; n2 = parse_expr >] -> n1+n2
|
||||
| [< >] -> n1
|
||||
]}
|
||||
|
||||
One should notice that the use of the [parser] keyword and associated
|
||||
|
|
Loading…
Reference in New Issue