On 1/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
+Matching against a C<Grammar> object will call the C<top> method
+defined in the grammar.  The C<top> method may either be a rule
+itself, or may call the actual top rule automatically.  How the
+C<Grammar> determines the top rule is up to the grammar, but normal
+Perl 6 grammars will default to setting top to the first rule in the
+original base grammar.  Derived grammars then inherit this idea of
+the top rule.  This may be overridden in either the base grammar or a
+derived grammer by explicitly naming a rule "top", or defining your
+own top method to call some other rule.

 Matching against a C<Signature> does not actually bind any variables,
 but only tests to see if the signature I<could> bind.  To really bind

"top"--an all lowercase reserved word? it just doesn't stand out. all
grammars i've seen and written so far have used all lower-case rule
names.

if you're going to explicitly set a top rule, like a main sub, make it
all uppercase.

   grammar DerivedGrammar is BaseGrammar;
   rule TOP { ... }

that makes it more clear that something is special about that rule..
~jerry

Reply via email to