Branch: Tag:

2014-02-16

2014-02-16 16:05:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added syntax for declaring type types.

The program type can now be used to declare type types:

program(int(8bit)) == type(int(8bit))

This avoids the need to go via typedefs, typeof() or _typeof().

1336:    | TOK_MAPPING_ID opt_mapping_type {}    | TOK_FUNCTION_ID opt_function_type {}    | TOK_OBJECT_ID opt_object_type {} -  | TOK_PROGRAM_ID opt_object_type { push_type(T_PROGRAM); } +  | TOK_PROGRAM_ID opt_program_type { push_type(T_PROGRAM); }    | TOK_ARRAY_ID opt_array_type { push_type(T_ARRAY); }    | TOK_MULTISET_ID opt_array_type { push_type(T_MULTISET); }    | TOK_ATTRIBUTE_ID '(' string_constant ',' type7 ')'
1589:    }    ;    + opt_program_type: /* Empty */ { push_object_type(0, 0); } +  | '(' type4 ')' +  | '(' error ')' +  { +  push_object_type(0, 0); +  yyerror("Invalid program subtype."); +  } +  ; +    opt_function_type: '('    {    type_stack_mark();