X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Fparsergen.mdc;h=0099f5785db32072118b228473d8aa94ed9bf09f;hp=e821e2cc4fe361ab2700bf44bcf952b0da96620b;hb=6a0710bfe1622b5420ba53dca034ed18376b8740;hpb=36adc544609b6144adefa0a000f77d2845b814e2 diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index e821e2c..0099f57 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -235,6 +235,12 @@ The data type name is simply stored and applied to the head of all subsequent productions. It must be the name of a structure, so `$expr` maps to `struct expr`. +Any productions given before the first data type will have no data type +and can carry no information. In order to allow other non-terminals to +have no type, the data type `$void` can be given. This does *not* mean +that `struct void` will be used, but rather than no type will be +associated with future non-terminals. + The precedence line must contain a list of symbols - typically terminal symbols, but not necessarily. It can only contain symbols that have not been seen yet, so precedence declaration must precede @@ -282,6 +288,8 @@ production inherits from the last symbol which has a precedence. assoc = Non; else { g->current_type = t.txt; + if (text_is(t.txt, "void")) + g->current_type.txt = NULL; t = token_next(ts); if (t.num != TK_newline) { err = "Extra tokens after type name";