资料来源 : pyDict
语法,基本原理
资料来源 : Webster's Revised Unabridged Dictionary (1913)
Grammar \Gram"mar\, n. [OE. gramere, OF. gramaire, F. grammaire
Prob. fr. L. gramatica Gr ?, fem. of ? skilled in grammar,
fr. ? letter. See {Gramme}, {Graphic}, and cf. {Grammatical},
{Gramarye}.]
1. The science which treats of the principles of language;
the study of forms of speech, and their relations to one
another; the art concerned with the right use aud
application of the rules of a language, in speaking or
writing.
Note: The whole fabric of grammar rests upon the classifying
of words according to their function in the sentence.
--Bain.
2. The art of speaking or writing with correctness or
according to established usage; speech considered with
regard to the rules of a grammar.
The original bad grammar and bad spelling.
--Macaulay.
3. A treatise on the principles of language; a book
containing the principles and rules for correctness in
speaking or writing.
4. treatise on the elements or principles of any science; as,
a grammar of geography.
{Comparative grammar}, the science which determines the
relations of kindred languages by examining and comparing
their grammatical forms.
{Grammar school}.
(a) A school, usually endowed, in which Latin and Greek
grammar are taught, as also other studies preparatory
to colleges or universities; as, the famous Rugby
Grammar School. This use of the word is more common in
England than in the United States.
When any town shall increase to the number of a
hundred families or householders, they shall set
up a grammar school, the master thereof being
able to instruct youth so far as they may be
fitted for the University. --Mass.
Records
(1647).
(b) In the American system of graded common schools an
intermediate grade between the primary school and the
high school, in which the principles of English
grammar are taught.
Grammar \Gram"mar\, v. i.
To discourse according to the rules of grammar; to use
grammar. [Obs.] --Beau. & Fl.
资料来源 : WordNet®
grammar
n : studies of the formation of basic linguistic units
资料来源 : Free On-Line Dictionary of Computing
grammar
A formal definition of the syntactic structure of a language
(see {syntax}), normally given in terms of {production rule}s
which specify the order of constituents and their
sub-constituents in a {sentence} (a well-formed string in the
language). Each rule has a left-hand side symbol naming a
syntactic category (e.g. "noun-phrase" for a {natural
language} grammar) and a right-hand side which is a sequence
of zero or more symbols. Each symbol may be either a
{terminal symbol} or a non-terminal symbol. A terminal symbol
corresponds to one "{lexeme}" - a part of the sentence with
no internal syntactic structure (e.g. an identifier or an
operator in a computer language). A non-terminal symbol is
the left-hand side of some rule.
One rule is normally designated as the top-level rule which
gives the structure for a whole sentence.
A grammar can be used either to parse a sentence (see
{parser}) or to generate one. Parsing assigns a terminal
syntactic category to each input token and a non-terminal
category to each appropriate group of tokens, up to the level
of the whole sentence. Parsing is usually preceded by
{lexical analysis}. Generation starts from the top-level rule
and chooses one alternative production wherever there is a
choice.
See also {BNF}, {yacc}, {attribute grammar}, {grammar
analysis}.