start working on the code generation for the Obj stuff

This commit is contained in:
Bill Currie 2002-05-08 05:55:57 +00:00
parent b226d24b52
commit b03bfa7a6e

View file

@ -119,7 +119,7 @@ typedef struct {
%type <def> def_name %type <def> def_name
%type <def> def_item def_list %type <def> def_item def_list
%type <expr> const opt_expr expr arg_list element_list element_list1 element %type <expr> const opt_expr expr arg_list element_list element_list1 element
%type <expr> string_val opt_state_expr %type <expr> string_val opt_state_expr obj_expr
%type <expr> statement statements statement_block %type <expr> statement statements statement_block
%type <expr> break_label continue_label enum_list enum %type <expr> break_label continue_label enum_list enum
%type <function> begin_function %type <function> begin_function
@ -128,6 +128,7 @@ typedef struct {
%type <scope> param_scope %type <scope> param_scope
%type <string_val> selector %type <string_val> selector
%type <param> keyworddecl keywordselector
%expect 1 %expect 1
@ -785,7 +786,7 @@ expr
| '&' expr %prec UNARY { $$ = address_expr ($2, 0, 0); } | '&' expr %prec UNARY { $$ = address_expr ($2, 0, 0); }
| INCOP expr { $$ = incop_expr ($1, $2, 0); } | INCOP expr { $$ = incop_expr ($1, $2, 0); }
| expr INCOP { $$ = incop_expr ($2, $1, 1); } | expr INCOP { $$ = incop_expr ($2, $1, 1); }
| obj_expr { /* XXX */ } | obj_expr { $$ = $1; }
| NAME { $$ = new_name_expr ($1); } | NAME { $$ = new_name_expr ($1); }
| const { $$ = $1; } | const { $$ = $1; }
| '(' expr ')' { $$ = $2; $$->paren = 1; } | '(' expr ')' { $$ = $2; $$->paren = 1; }
@ -852,7 +853,7 @@ string_val
} }
; ;
obj_def obj_def /* XXX */
: classdef : classdef
| classdecl | classdecl
| protocoldef | protocoldef
@ -860,16 +861,16 @@ obj_def
| END | END
; ;
identifier_list identifier_list /* XXX */
: NAME { /* XXX */ } : NAME {}
| identifier_list ',' NAME | identifier_list ',' NAME
; ;
classdecl classdecl /* XXX */
: CLASS identifier_list : CLASS identifier_list
; ;
classdef classdef /* XXX */
: INTERFACE NAME protocolrefs '{' : INTERFACE NAME protocolrefs '{'
ivar_decl_list '}' ivar_decl_list '}'
methodprotolist methodprotolist
@ -896,46 +897,46 @@ classdef
| IMPLEMENTATION NAME '(' NAME ')' | IMPLEMENTATION NAME '(' NAME ')'
; ;
protocoldef protocoldef /* XXX */
: PROTOCOL NAME protocolrefs : PROTOCOL NAME protocolrefs
methodprotolist END methodprotolist END
; ;
protocolrefs protocolrefs /* XXX */
: /* emtpy */ : /* emtpy */
| '<' identifier_list '>' | '<' identifier_list '>'
; ;
ivar_decl_list ivar_decl_list /* XXX */
: ivar_decl_list visibility_spec ivar_decls : ivar_decl_list visibility_spec ivar_decls
| ivar_decls | ivar_decls
; ;
visibility_spec visibility_spec /* XXX */
: PRIVATE : PRIVATE
| PROTECTED | PROTECTED
| PUBLIC | PUBLIC
; ;
ivar_decls ivar_decls /* XXX */
: /* empty */ : /* empty */
| ivar_decls ivar_decl ';' | ivar_decls ivar_decl ';'
; ;
ivar_decl ivar_decl /* XXX */
: type ivars { /* XXX */ } : type ivars {}
; ;
ivars ivars /* XXX */
: ivar_declarator : ivar_declarator
| ivars ',' ivar_declarator | ivars ',' ivar_declarator
; ;
ivar_declarator ivar_declarator /* XXX */
: NAME { /* XXX */ } : NAME {}
; ;
methoddef methoddef /* XXX */
: '+' : '+'
methoddecl opt_state_expr methoddecl opt_state_expr
begin_function statement_block end_function begin_function statement_block end_function
@ -944,40 +945,40 @@ methoddef
begin_function statement_block end_function begin_function statement_block end_function
; ;
methodprotolist methodprotolist /* XXX */
: /* emtpy */ : /* emtpy */
| methodprotolist2 | methodprotolist2
; ;
methodprotolist2 methodprotolist2 /* XXX */
: methodproto : methodproto
| methodprotolist2 methodproto | methodprotolist2 methodproto
; ;
methodproto methodproto /* XXX */
: '+' methoddecl ';' : '+' methoddecl ';'
| '-' methoddecl ';' | '-' methoddecl ';'
; ;
methoddecl methoddecl /* XXX */
: '(' type ')' unaryselector : '(' type ')' unaryselector
| unaryselector | unaryselector
| '(' type ')' keywordselector optparmlist | '(' type ')' keywordselector optparmlist {}
| keywordselector optparmlist | keywordselector optparmlist {}
; ;
optparmlist optparmlist /* XXX */
: /* empty */ : /* empty */
| ',' ELLIPSIS | ',' ELLIPSIS
; ;
unaryselector unaryselector /* XXX */
: selector { /* XXX */ } : selector {}
; ;
keywordselector keywordselector
: keyworddecl : keyworddecl
| keywordselector keyworddecl | keywordselector keyworddecl { $2->next = $1; $$ = $2; }
; ;
selector selector
@ -985,63 +986,63 @@ selector
; ;
keyworddecl keyworddecl
: selector ':' '(' type ')' NAME { /* XXX */ } : selector ':' '(' type ')' NAME
| selector ':' NAME { /* XXX */ } { $$ = new_param ($1, $4, $6); }
| ':' '(' type ')' NAME { /* XXX */ } | selector ':' NAME
| ':' NAME { /* XXX */ } { $$ = new_param ($1, 0/*&type_id*/, $3); }
| ':' '(' type ')' NAME
{ $$ = new_param (0, $3, $5); }
| ':' NAME
{ $$ = new_param (0, 0/*&type_id*/, $2); }
; ;
messageargs messageargs /* XXX */
: selector { /* XXX */ } : selector {}
| keywordarglist | keywordarglist
; ;
keywordarglist keywordarglist /* XXX */
: keywordarg : keywordarg
| keywordarglist keywordarg | keywordarglist keywordarg
; ;
keywordexpr keywordarg /* XXX */
: expr { /* XXX */ } : selector ':' expr {}
| ':' expr
; ;
keywordarg receiver /* XXX */
: selector ':' keywordexpr { /* XXX */ } : expr {}
| ':' keywordexpr
; ;
receiver obj_expr /* XXX */
: expr { /* XXX */ } : obj_messageexpr {}
| SELECTOR '(' selectorarg ')' {}
| PROTOCOL '(' NAME ')' {}
| ENCODE '(' type ')' {}
| obj_string {}
; ;
obj_expr obj_messageexpr /* XXX */
: obj_messageexpr
| SELECTOR '(' selectorarg ')'
| PROTOCOL '(' NAME ')'
| ENCODE '(' type ')'
| obj_string
;
obj_messageexpr
: '[' receiver messageargs ']' : '[' receiver messageargs ']'
; ;
selectorarg selectorarg /* XXX */
: selector { /* XXX */ } : selector {}
| keywordnamelist | keywordnamelist
; ;
keywordnamelist keywordnamelist /* XXX */
: keywordname : keywordname
| keywordnamelist keywordname | keywordnamelist keywordname
; ;
keywordname keywordname /* XXX */
: selector ':' { /* XXX */ } : selector ':' {}
| ':' | ':'
; ;
obj_string obj_string /* XXX */
: '@' STRING_VAL : '@' STRING_VAL
| obj_string '@' STRING_VAL | obj_string '@' STRING_VAL
; ;