+block ::= constant(constant). {
+ P->consts = add_constant(P->consts, constant);
+}
+block ::= decl_struct(strct). {
+ P->structs = add_decl_struct(P->structs, strct);
+}
+
+%type decl_struct {decl_struct*}
+decl_struct(strct) ::= STRUCT NAME(N) LBRACE struct_args(args) RBRACE. {
+ strct = init_decl_struct(N->text, args);
+}
+
+%type const_type {const_type*}
+const_type(type_) ::= BOOL(T). {
+ type_ = init_const_type(T->type, T->text);
+ free(T);
+}
+const_type(type_) ::= INT(T). {
+ type_ = init_const_type(T->type, T->text);
+ free(T);
+}
+const_type(type_) ::= FLOAT(T). {
+ type_ = init_const_type(T->type, T->text);
+ free(T);
+}
+const_type(type_) ::= STRING(T). {
+ type_ = init_const_type(T->type, T->text);
+ free(T);
+}
+%type constant {constant*}
+constant(constant) ::= CONST const_type(type) NSNAME(T) EQUALS impl_def_val(val) EOS. {
+ constant = init_constant(type, T->text, val);
+ free(T);
+}