[svn:parrot] r38341 - branches/pmc_pct/compilers/pmc/src/parser

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Apr 25 10:06:25 UTC 2009


Author: bacek
Date: Sat Apr 25 10:06:24 2009
New Revision: 38341
URL: https://trac.parrot.org/parrot/changeset/38341

Log:
Fix PMC grammar.

Modified:
   branches/pmc_pct/compilers/pmc/src/parser/grammar.pg

Modified: branches/pmc_pct/compilers/pmc/src/parser/grammar.pg
==============================================================================
--- branches/pmc_pct/compilers/pmc/src/parser/grammar.pg	Sat Apr 25 10:06:00 2009	(r38340)
+++ branches/pmc_pct/compilers/pmc/src/parser/grammar.pg	Sat Apr 25 10:06:24 2009	(r38341)
@@ -31,25 +31,27 @@
 
 # pmc action will store "header" and "footer"
 rule pmc {
-    'pmclass' <identifier> <traits>* '{'
+    pmclass <identifier> 
+    {*}                                     #= begin
+    <traits>* '{'
         <attribute>*
         <body>
     '}'
-    {*}
+    {*}                                     #= end
 }
 
 rule traits {
     [
-    | 'extends'     <identifier>
-    | 'provides'    <identifier>
-    | 'group'       <identifier>
-    | 'lib'         <identifier>
-    | 'need_ext'
-    | 'abstract'
-    | 'no_init'
-    | 'singleton'
-    | 'dynpmc'
-    | 'no_ro'
+    | 'extends'     <identifier>            {*} #= extends
+    | 'provides'    <identifier>            {*} #= provides
+    | 'group'       <identifier>            {*} #= group
+    | 'lib'         <identifier>            {*} #= lib
+    | 'need_ext'                            {*} #= need_ext
+    | 'abstract'                            {*} #= abstract
+    | 'no_init'                             {*} #= no_init
+    | 'singleton'                           {*} #= singleton
+    | 'dynpmc'                              {*} #= dynpmc
+    | 'no_ro'                               {*} #= no_ro
     ]
 }
 
@@ -59,8 +61,14 @@
 
 # Body of PMC class. 
 rule body {
-    [ <class_init> | <vtable> | <method> | <multi> ]* 
-    {*}
+    <body_part>*
+}
+
+rule body_part {
+    | <class_init>  {*} #= class_init
+    | <vtable>      {*} #= vtable
+    | <method>      {*} #= method
+    | <multi>       {*} #= multi
 }
 
 # PMC can have class_init function.
@@ -69,21 +77,21 @@
     {*}
 }
 
-rule vtable {
-    'VTABLE' || <c_signature> <c_body>
-    {*}
-}
-
 rule method {
-    'METHOD' [
+    'METHOD' :: [
         [ <identifier> '(' <parrot_c_arguments> ')' <c_body> ]
         | <.panic: "Unexpected METHOD content">
     ]
     {*}
 }
 
+rule vtable {
+    'VTABLE' :: <c_signature> <c_body>
+    {*}
+}
+
 rule multi {
-    'MULTI' <c_signature> <c_body>
+    'MULTI' :: <c_signature> <c_body>
     {*}
 }
 
@@ -141,7 +149,7 @@
 }
 
 token identifier {
-    <.ident>
+    <.ident> 
 }
 
 ## ws token handles whitespaces and C /* */ comments


More information about the parrot-commits mailing list