From d68f05d75c678a450a641189d07491d8b839f806 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 10 Dec 2018 07:15:21 +0100 Subject: [PATCH] style: s/non-terminal/nonterminal/ I personally prefer 'non terminal', or 'non-terminal', but 'nonterminal' is the common spelling. * data/glr.c, src/parse-gram.y, src/symtab.c, src/symtab.h, * tests/input.at, doc/refcard.tex: here. --- TODO | 8 ++++---- data/glr.c | 2 +- doc/bison.texi | 2 +- doc/refcard.tex | 14 +++++++------- src/parse-gram.c | 2 +- src/parse-gram.y | 2 +- src/state.h | 2 +- src/symtab.c | 6 +++--- src/symtab.h | 2 +- tests/input.at | 10 +++++----- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/TODO b/TODO index 4813ed75..342d2917 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,6 @@ Several features are not available in all the backends. * Short term ** consistency -nonterminal vs non terminal vs non-terminal token vs terminal ** yacc.c @@ -214,9 +213,10 @@ Provide better assistance for understanding the conflicts by providing a sample text exhibiting the (LALR) ambiguity. See the paper from DeRemer and Penello: they already provide the algorithm. -** Statically check for potential ambiguities in GLR grammars. See - for an approach. - +** Statically check for potential ambiguities in GLR grammars +See for an approach. +An Experimental Ambiguity Detection Tool ∗ Sylvain Schmitz +LORIA, INRIA Nancy - Grand Est, Nancy, France * Extensions ** Multiple start symbols diff --git a/data/glr.c b/data/glr.c index de3fc90d..64237b8b 100644 --- a/data/glr.c +++ b/data/glr.c @@ -639,7 +639,7 @@ struct yyGLRState { size_t yyposn; union { /** First in a chain of alternative reductions producing the - * non-terminal corresponding to this state, threaded through + * nonterminal corresponding to this state, threaded through * yynext. */ yySemanticOption* yyfirstVal; /** Semantic value for this state. */ diff --git a/doc/bison.texi b/doc/bison.texi index e20ae028..b8a62189 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -9947,7 +9947,7 @@ Entering state 1 This first batch shows a specific feature of this grammar: the first rule (which is in line 34 of @file{mfcalc.y} can be reduced without even having to look for the first token. The resulting left-hand symbol (@code{$$}) is -a valueless (@samp{()}) @code{input} non terminal (@code{nterm}). +a valueless (@samp{()}) @code{input} nonterminal (@code{nterm}). Then the parser calls the scanner. @example diff --git a/doc/refcard.tex b/doc/refcard.tex index 772cb02b..b41dd79a 100644 --- a/doc/refcard.tex +++ b/doc/refcard.tex @@ -358,7 +358,7 @@ otherwise it will have the format {\tt {\it name}.tab.h}, where In the above, {\it t} is a {\it type} defined in the {\tt \%union} definition, {\it n} is a {\it terminal} symbol name, {\it m} is a -{\it non-terminal} symbol name, and {\it association} can be one of +{\it nonterminal} symbol name, and {\it association} can be one of {\tt \%left}, {\tt \%right}, or {\tt \%nonassoc}. \vskip .10truein @@ -401,16 +401,16 @@ Rules take the form: \vskip -\baselineskip \beginexample - non-terminal : {\it statement} 1 - | {\it statement} 2 - \vdots - | {\it statement n} - ; + nonterminal : {\it statement} 1 + | {\it statement} 2 + \vdots + | {\it statement n} + ; \endexample Where {\it statements} can be either empty, or contain a mixture of C code (enclosed in {\tt \{...\}}), and the -symbols that make up the non-terminal. For example: +symbols that make up the nonterminal. For example: \vskip -\baselineskip \beginexample diff --git a/src/parse-gram.c b/src/parse-gram.c index 82648e2f..076448fb 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -2705,7 +2705,7 @@ yyreduce: if (current_class == nterm_sym) { gram_error (&(yylsp[0]), - _("character literals cannot be non-terminals")); + _("character literals cannot be nonterminals")); YYERROR; } (yyval.id) = symbol_get (char_name ((yyvsp[0].CHAR)), (yylsp[0])); diff --git a/src/parse-gram.y b/src/parse-gram.y index bc8f22d7..865153b5 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -641,7 +641,7 @@ id: if (current_class == nterm_sym) { gram_error (&@1, - _("character literals cannot be non-terminals")); + _("character literals cannot be nonterminals")); YYERROR; } $$ = symbol_get (char_name ($1), @1); diff --git a/src/state.h b/src/state.h index 9fb968f7..e918ca60 100644 --- a/src/state.h +++ b/src/state.h @@ -117,7 +117,7 @@ typedef struct /* What is the symbol labelling the transition to TRANSITIONS->states[Num]? Can be a token (amongst which the error - token), or non terminals in case of gotos. */ + token), or nonterminals in case of gotos. */ # define TRANSITION_SYMBOL(Transitions, Num) \ (Transitions->states[Num]->accessing_symbol) diff --git a/src/symtab.c b/src/symtab.c index 54525f17..0caf063a 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -478,7 +478,7 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc) int *user_token_numberp = &sym->content->user_token_number; if (sym->content->class != token_sym) complain (&loc, complaint, - _("non-terminals cannot be given an explicit number")); + _("nonterminals cannot be given an explicit number")); else if (*user_token_numberp != USER_NUMBER_UNDEFINED && *user_token_numberp != user_token_number) complain (&loc, complaint, _("redefining user token number of %s"), @@ -614,7 +614,7 @@ symbol_make_alias (symbol *sym, symbol *str, location loc) { if (sym->content->class != token_sym) complain (&loc, complaint, - _("non-terminals cannot be given a string alias")); + _("nonterminals cannot be given a string alias")); else if (str->alias) complain (&loc, Wother, _("symbol %s used more than once as a literal string"), str->tag); @@ -677,7 +677,7 @@ complain_user_token_number_redeclared (int num, symbol *first, symbol *second) static inline bool symbol_translation (symbol *this) { - /* Non-terminal? */ + /* Nonterminal? */ if (this->content->class == token_sym && !this->is_alias) { diff --git a/src/symtab.h b/src/symtab.h index 23806b5f..63cc122a 100644 --- a/src/symtab.h +++ b/src/symtab.h @@ -40,7 +40,7 @@ typedef enum { unknown_sym, /**< Undefined. */ token_sym, /**< Terminal. */ - nterm_sym /**< Non-terminal. */ + nterm_sym /**< Nonterminal. */ } symbol_class; diff --git a/tests/input.at b/tests/input.at index 28dbe570..44803ce5 100644 --- a/tests/input.at +++ b/tests/input.at @@ -152,28 +152,28 @@ AT_BISON_CHECK([-fcaret input.y], [1], [], [[input.y:1.1-6: warning: deprecated directive, use '%type' [-Wdeprecated] %nterm expr "expression"; ^^^^^^ -input.y:1.13-24: error: non-terminals cannot be given a string alias +input.y:1.13-24: error: nonterminals cannot be given a string alias %nterm expr "expression"; ^^^^^^^^^^^^ input.y:2.1-6: warning: deprecated directive, use '%type' [-Wdeprecated] %nterm term 123; ^^^^^^ -input.y:2.13-15: error: non-terminals cannot be given an explicit number +input.y:2.13-15: error: nonterminals cannot be given an explicit number %nterm term 123; ^^^ input.y:3.1-6: warning: deprecated directive, use '%type' [-Wdeprecated] %nterm fact 124 "factor"; ^^^^^^ -input.y:3.13-15: error: non-terminals cannot be given an explicit number +input.y:3.13-15: error: nonterminals cannot be given an explicit number %nterm fact 124 "factor"; ^^^ -input.y:3.17-24: error: non-terminals cannot be given a string alias +input.y:3.17-24: error: nonterminals cannot be given a string alias %nterm fact 124 "factor"; ^^^^^^^^ input.y:4.1-6: warning: deprecated directive, use '%type' [-Wdeprecated] %nterm '+' '*'; ^^^^^^ -input.y:4.8-10: error: character literals cannot be non-terminals +input.y:4.8-10: error: character literals cannot be nonterminals %nterm '+' '*'; ^^^ input.y:5.1-6: warning: deprecated directive, use '%type' [-Wdeprecated]