bnf
-
genelde programlama dilleri için kullanılsa da natural languages için de kullanılabilir.
örneğin phrase structure grammer'ı g = (v, t, s, p) olan ingilizcenin alt kümesi bir dil düşünelim. sırasıyla vocabulary, terminal, starting symbol ve productions'ı aşağıdaki gibi tanımlı olsun:
v = {(sentence), (noun phrase), (verb phrase), (article), (adjective), (noun), (verb),
(adverb), a, the, large, hungry, rabbit, mathematician, eats, hops, quickly, wildly}
t = {a, the, large, hungry, rabbit, mathematician, eats, hops, quickly, wildly}
s = (sentence)
p = { (sentence) › (noun phrase) (verb phrase),
(noun phrase) › (article) (adjective) (noun),
(noun phrase) › (article) (noun),
(verb phrase) › (verb) (adverb),
(verb phrase) › (verb),
(article) › a,
(article) › the,
(adjective) › large,
(adjective) › hungry,
(noun) › rabbit,
(noun) › mathematician,
(verb) › eats,
(verb) › hops,
(adverb) › quickly,
(adverb) › wildly }
bu dilin backus-naur form (bnf)'u şu şekilde yazılır:
<sentence> ::= <noun phrase> <verb phrase>
<noun phrase> ::= <article> [<adjective>] <noun>
<verb phrase> ::= <verb> [<adverb>]
<article> ::= a | the
<adjective> ::= large | hungry
<noun> ::= rabbit | mathematician
<verb> ::= eats | hops
<adverb> ::= quickly | wildly
ekşi sözlük kullanıcılarıyla mesajlaşmak ve yazdıkları entry'leri
takip etmek için giriş yapmalısın.
hesabın var mı? giriş yap