Is there any BNF with arguments for nonterminal characters?

When working with Prolog DCG for parsing, it is useful to have an auxiliary BNF grammar.

For instance:

Bnf

<Sentence> ::= <Noun_phrase> <Verb_phrase>
<Noun_phrase> ::= <Determiner> <Noun>
<Verb_phrase> ::= <Verb> <Phrase>
<Determiner> ::= a
<Determiner> ::= the
<Noun> ::= cat
<Noun> ::= mouse
<Verb> ::= scares
<Verb> ::= hates

like Prolog DCG

sentence --> noun_phrase, verb_phrase.
verb_phrase --> verb, noun_phrase.
noun_phrase --> determiner, noun.
determiner --> [a].
determiner --> [the].
noun --> [cat].
noun --> [mouse].
verb --> [scares].
verb --> [hates].

However, Prolog DCG may also have arguments as
in this example Numberfor singularorplural

sentence(Number) --> noun_phrase(Number), verb_phrase(Number).
verb_phrase(Number) --> verb(Number), noun_phrase(Number).
noun_phrase(Number) --> determiner(Number), noun(Number).
determiner(singular) --> [a].
determiner(singular) --> [the].
determiner(plural) --> [the].
noun(singular) --> [cat].
noun(plural) --> [cats].
noun(singular) --> [mouse].
noun(plural) --> [mice].
verb(singular) --> [scares].
verb(plural) --> [scare].
verb(singular) --> [hates].
verb(plural) --> [hate].

Is there a standard or accepted extension for BNF that includes arguments for non-terminals?

If so, I need a link to it.

I suspect that ATNs (Augmented Transition Networks) are in a ball park and may be the only standard answer, but I hope for something that is linear text and not some form of vertex / edge.

+4
source share
1

, - , ; , , .

BNF, . NLTK ( Python) , . , :

S -> NP[CASE=nom, AGR=?a] VP[AGR=?a]
VP[AGR=?a] -> TV[OBJCASE=?c, AGR=?a] NP[CASE=?c]
NP[CASE=?c, AGR=?a] -> Det[CASE=?c, AGR=?a] N[CASE=?c, AGR=?a]

?x - . .

+2

Source: https://habr.com/ru/post/1666404/


All Articles