cvsuser     03/10/20 21:52:00

  Modified:    languages/imcc imcc.l imcc.y
  Log:
  Add .class, .method and .field keywords, not functional yet.
  
  Revision  Changes    Path
  1.68      +2 -0      parrot/languages/imcc/imcc.l
  
  Index: imcc.l
  ===================================================================
  RCS file: /cvs/public/parrot/languages/imcc/imcc.l,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -w -r1.67 -r1.68
  --- imcc.l    14 Oct 2003 07:40:02 -0000      1.67
  +++ imcc.l    21 Oct 2003 04:51:59 -0000      1.68
  @@ -202,6 +202,8 @@
   ".endclass"     return(ENDCLASS);
   ".namespace"    return(NAMESPACE);
   ".endnamespace" return(ENDNAMESPACE);
  +".field"        return(FIELD);
  +".method"       return(METHOD);
   ".local"        return(LOCAL);
   ".const"        return(CONST);
   ".globalconst"  return(GLOBAL_CONST);
  
  
  
  1.96      +41 -4     parrot/languages/imcc/imcc.y
  
  Index: imcc.y
  ===================================================================
  RCS file: /cvs/public/parrot/languages/imcc/imcc.y,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -w -r1.95 -r1.96
  --- imcc.y    13 Oct 2003 07:54:46 -0000      1.95
  +++ imcc.y    21 Oct 2003 04:51:59 -0000      1.96
  @@ -201,7 +201,8 @@
   %nonassoc <t> PARAM
   
   %token <t> CALL GOTO ARG FLATTEN_ARG IF UNLESS NEW END SAVEALL RESTOREALL
  -%token <t> SUB NAMESPACE ENDNAMESPACE CLASS ENDCLASS SYM LOCAL CONST
  +%token <t> NAMESPACE ENDNAMESPACE CLASS ENDCLASS FIELD METHOD
  +%token <t> SUB SYM LOCAL CONST
   %token <t> INC DEC GLOBAL_CONST
   %token <t> SHIFT_LEFT SHIFT_RIGHT INTV FLOATV STRINGV DEFINED LOG_XOR
   %token <t> RELOP_EQ RELOP_NE RELOP_GT RELOP_GTE RELOP_LT RELOP_LTE
  @@ -215,7 +216,8 @@
   %token <s> IREG NREG SREG PREG IDENTIFIER STRINGC INTC FLOATC REG MACRO ENDM
   %token <s> PARROT_OP
   %type <t> type
  -%type <i> program sub sub_start emit pcc_sub sub_body pcc_ret pcc_yield
  +%type <i> program class class_body member_decls member_decl field_decl method_decl
  +%type <i> sub sub_start emit pcc_sub sub_body pcc_ret pcc_yield
   %type <i> compilation_units compilation_unit
   %type <s> classname relop
   %type <i> labels _labels label statements statement
  @@ -243,7 +245,9 @@
       compilation_units            { close_comp_unit(interp); $$ = 0; }
       ;
   
  -compilation_unit:    sub
  +compilation_unit:
  +          class
  +        | sub
           | pcc_sub
           | emit
           | MACRO '\n'                  { $$ = 0; }
  @@ -254,7 +258,6 @@
       | compilation_units compilation_unit
       ;
   
  -
   pasmcode: pasmline
       | pasmcode pasmline
       ;
  @@ -276,6 +279,7 @@
                                           }
       | /* none */                        { $$ = 0;}
       ;
  +
   pasm_args:
       vars
       ;
  @@ -287,6 +291,39 @@
         EOM                            { if (optimizer_level & OPT_PASM)
                                                   allocate(interp);
                                             emit_flush(interp); $$=0;}
  +    ;
  +
  +class:
  +        CLASS class_body ENDCLASS
  +        { $$ = 0; }
  +    ;
  +
  +class_body:
  +        member_decls
  +    ;
  +
  +member_decls:
  +        member_decl
  +    |   member_decls member_decl
  +    ; 
  +
  +member_decl:
  +        field_decl
  +    |   method_decl
  +    ;
  +
  +field_decl:
  +        FIELD type IDENTIFIER
  +        {
  +           $$ = 0;
  +        }
  +    ;
  +
  +method_decl:
  +        METHOD IDENTIFIER
  +        {
  +           $$ = 0;
  +        }
       ;
   
   sub: sub_start
  
  
  

Reply via email to