请输入您要查询的字词:

 

单词 grammar
释义
grammar

Computer
  • One of the principal ways of specifying an infinite formal language by finite means. A grammar consists of a set of rules (called productions or rewrite rules) that may be used to derive one string from another by substring replacement. The strings of the specified language are obtained by repeated application of these rules, starting from some initial string. A grammar however has the additional feature that the alphabet is divided into a set T of terminal symbols and a set N of nonterminal symbols (or variables). While productions may be composed arbitrarily of terminals and nonterminals, the specified language contains strings of terminals only.

    A grammar G can therefore be defined as comprising two sets of symbols T and N, a semi-Thue system over the union TN, and a distinguished member S of N. The language generated by G is the set of all strings over T that can be derived from S by a sequence of substring replacements (see semi-Thue system); S is known as the start symbol or sentence symbol. As an example, let T be {b,c}, N be {S,A} and let the productions be

    1. (1) SSA

    2. (2) SA

    3. (3) Abc

    Then, for instance, starting from S we can derive bcbcbc via the following sequence (among others):
    • SA by production 1

    • SAA by production 1

    • AAA by production 2

    • bcAA by production 3

    • bcbcA by production 3

    • bcbcbc by production 3

    The language generated is

    {bc,bcbc,bcbcbc,}
    These are the only strings of bs and cs in {b,c}* derivable from the start symbol S by the three production rules. A string such as SAbcA, which is derivable from S but still contains nonterminals, is referred to as a sentential form.

    This is the most general form of grammar. Typically however some restriction is placed on the form that productions may take (see context-free grammar, context-sensitive grammar, regular grammar). The syntax of programming languages is usually specified by context-free grammars; the example given above is context-free, although the language can be specified by a regular grammar.

    A slightly different way of generating a language is by means of an L-system (or Lindenmeyer system). A different approach altogether is to define a machine that tests any string for membership of the language, i.e. an automaton.


Philosophy
  • The systematic ways in which sentences of a language may be built. Grammar is typically studied independently of phonetics and semantics. Its two branches are syntax, or the way words make sentences, and morphology, which includes the recognition of syntactically significant parts of words. A grammar that aspires to find categories and rules applicable to all (human) languages is a universal grammar. Grammar may be pursued in various ways: a formal grammar aspires to the production of a proof procedure or algorithm separating the well-formed sentences of a language from other strings of words. The different levels of complexity of such algorithms defines the hierarchy of abstract structures for languages described originally by Chomsky. A descriptive grammar describes actual usages in a language, whereas a prescriptive grammar legislates for correct and incorrect usage. See also generative grammar.


随便看

 

科学参考收录了60776条科技类词条,基本涵盖了常见科技类参考文献及英语词汇的翻译,是科学学习和研究的有利工具。

 

Copyright © 2000-2023 Sciref.net All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/6 3:31:03