"irrallaan kontekstista"

Halla-aholaisten lanseeraama ”irrallaan kontekstista” sopisi hyvin PerusS:n puolueohjelmaksi.

Mitään muuta ei tarvita.
9297
Äänestä

Muut lukivat myös

Vastaukset 9

Vanhimmat

liian vaikea sinulle? Kouluun siitä, hus, hus!

Äänestä
  • Mene sinä myös

    Äänestä

  • mene mene vaan kirjoitti:

    Mene sinä myös

    että avaaja menisi opettajan työhönsä huomenna.

    Äänestä


  • "Irrallaan konktekstista" (context-free) ilmiötä on tutkittu. Siinä on kiteytetty hyvin PersS:n politiikan pääpiirteet:

    A context-free language in the political subtance:

    where

    1. is a finite set of non-terminal characters or variables. They represent different types of phrase or clause in the sentence.

    2. is a finite set of terminals, disjoint with , which make up the actual content of the sentence.

    3. is a relation from to such that .

    4. is the start variable, used to represent the whole sentence (or program). It must be an element of .

    In addition, is a finite set. The members of are called the rules or productions of the grammar. The asterisk represents the Kleene star operation.

    Additional Definition 1

    For any strings , we say yields , written as , if such that and . Thus, is the result of applying the rule to .

    Additional Definition 2

    For any (or in some textbooks) if such that

    Additional Definition 3

    The language of a grammar is the set


    Additional Definition 4

    A language is said to be a context-free language (CFL) if there exists a CFG, such that .

    Additional Definition 5

    A context-free grammar is said to be proper if it has:
    no useless symbols (inaccesible symbols or unproductive symbols)
    no ε-productions
    no cycles

    Examples

    Example 1
    S → a
    S → aS
    S → bS

    The terminals here are a and b, while the only non-terminal is S. The language described is all nonempty strings of as and bs that end in a.

    This grammar is regular: no rule has more than one nonterminal in its right-hand side, and each of these nonterminals is at the same end of the right-hand side.

    Every regular grammar corresponds directly to a nondeterministic finite automaton, so we know that this is a regular language.

    It is common to list all right-hand sides for the same left-hand side on the same line, using | to separate them, like this:
    S → a | aS | bS

    Technically, this is the same grammar as above.

    Example 2

    In a context-free grammar, we can pair up characters the way we do with brackets. The simplest example:
    S → aSb
    S → ab

    This grammar generates the language , which is not regular.

    The special character ε stands for the empty string. By changing the above grammar to :S → aSb | ε we obtain a grammar generating the language instead. This differs only in that it contains the empty string while the original grammar did not.

    Example 3

    Here is a context-free grammar for syntactically correct infix algebraic expressions in the variables x, y and z:
    S → x | y | z | S S | S - S | S * S | S/S | (S)

    This grammar can, for example, generate the string "( x y ) * x - z * y / ( x x )" as follows: "S" is the initial string. "S - S" is the result of applying the fifth transformation [S → S - S] to the nonterminal S. "S * S - S / S" is the result of applying the sixth transform to the first S and the seventh one to the second S. "( S ) * S - S / ( S )" is the result of applying the final transform to certain of the nonterminals. "( S S ) * S - S * S / ( S S )" is the result of the fourth and fifth transforms to certain nonterminals. "( x y ) * x - z * y / ( x x )" is the final result, obtained by using the first three transformations to turn the S nonterminals into the terminals x, y, and z.

    This grammar is ambiguous, meaning that one can generate the same string with more than one parse tree. For example, "x y * z" might have either the or the * parsed first; presumably these will produce different results. However, the language being described is not itself ambiguous: a different, unambiguous grammar can be written for it.

    Example 4

    A context-free grammar for the language consisting of all strings over {a,b} for which the number of a's and b's are different is
    S → U | V
    U → TaU | TaT
    V → TbV | TbT
    T → aTbT | bTaT | ε

    Here, the nonterminal T can generate all strings with the same number of a's as b's, the nonterminal U generates all strings with more a's than b's and the nonterminal V generates all strings with fewer a's than b's.

    Example 5

    Another example of a non-regular language is . It is context-free as it can be generated by the following context-free grammar:
    S → bSbb | A
    A → aA | ε

    Other examples

    Context-free grammars are not limited in application to mathematical ("formal") languages. For example, it has been suggested that a class of Tamil poetry called Venpa is described by a context-free grammar.[2]

    Derivations and syntax trees

    There are two common ways to describe how a given string can be derived from the start symbol of a given grammar. The simplest way is to list the consecutive strings of symbols, beginning with the start symbol and ending with the string, and the rules that have been applied. If we introduce a strategy such as "always replace the left-most nonterminal first" then for context-free grammars the list of applied grammar rules is by itself sufficient. This is called the leftmost derivation of a string. For example, if we take the following grammar:
    (1) S → S S
    (2) S → 1
    (3) S → a

    and the string "1 1 a" then a left derivation of this string is the list [ (1), (1), (2), (2), (3) ]. Analogously the rightmost derivation is defined as the list that we get if we always replace the rightmost nonterminal first. In this case this could be the list [ (1), (3), (1), (2), (2)].

    The distinction between leftmost derivation and rightmost derivation is important because in most parsers the transformation of the input is defined by giving a piece of code for every grammar rule that is executed whenever the rule is applied. Therefore it is important to know whether the parser determines a leftmost or a rightmost derivation because this determines the order in which the pieces of code will be executed. See for an example LL parsers and LR parsers.

    A derivation also imposes in some sense a hierarchical structure on the string that is derived. For example, if the string "1 1 a" is derived according to the leftmost derivation:
    S → S S (1)
    → S S S (1)
    → 1 S S (2)
    → 1 1 S (2)
    → 1 1 a (3)

    the structure of the string would be:
    { { { 1 }S { 1 }S }S { a }S }S

    where { ... }S indicates a substring recognized as belonging to S. This hierarchy can also be seen as a tree:
    S
    /|\
    / | \
    / | \
    S ' ' S
    /|\ |
    / | \ |
    S ' ' S 'a'
    | |
    '1' '1'

    This tree is called a concrete syntax tree (see also abstract syntax tree) of the string. In this case the presented leftmost and the rightmost derivations define the same syntax tree; however, there is another (leftmost) derivation of the same string
    S → S S (1)
    → 1 S (2)
    → 1 S S (1)
    → 1 1 S (2)
    → 1 1 a (3)

    and this defines the following syntax tree:
    S
    /|\
    / | \
    / | \
    S ' ' S
    | /|\
    | / | \
    '1' S ' ' S
    | |
    '1' 'a'

    If, for certain strings in the language of the grammar, there is more than one parsing tree, then the grammar is said to be an ambiguous grammar. Such grammars are usually hard to parse because the parser cannot always decide which grammar rule it has to apply. Usually, ambiguity is a feature of the grammar, not the language, and an unambiguous grammar can be found which generates the same context-free language. However, there are certain languages which can only be generated by ambiguous grammars; such languages are called inherently ambiguous.

    Normal forms

    Every context-free grammar that does not generate the empty string can be transformed into one in which no rule has the empty string as a product [a rule with ε as a product is called an ε-production]. If it does generate the empty string, it will be necessary to include the rule , but there need be no other ε-rule. Every context-free grammar with no ε-production has an equivalent grammar in Chomsky normal form or Greibach normal form. "Equivalent" here means that the two grammars generate the same language.

    Because of the especially simple form of production rules in Chomsky Normal Form grammars, this normal form has both theoretical and practical implications. For instance, given a context-free grammar, one can use the Chomsky Normal Form to construct a polynomial-time algorithm which decides whether a given string is in the language represented by that grammar or not (the CYK algorithm).

    Undecidable problems

    Although some operations on context-free grammars are decidable, due to their limited power, CFGs do have interesting undecidable problems. One of the simplest and most cited is the problem of deciding whether a CFG accepts the language of all strings. A reduction can be demonstrated to this problem from the well-known undecidable problem of determining whether a Turing machine accepts a particular input (the Halting problem). The reduction uses the concept of a computation history, a string describing an entire computation of a Turing machine. We can construct a CFG that generates all strings that are not accepting computation histories for a particular Turing machine on a particular input, and thus it will accept all strings only if the machine does not accept that input.

    As a consequence of this, it is also undecidable whether two CFGs describe the same language, since we can't even decide whether a CFG is equivalent to the trivial CFG deciding the language of all strings.

    Another point worth mentioning is that the problem of determining if a context-sensitive grammar describes a context-free language is undecidable.

    Extensions

    An obvious way to extend the context-free grammar formalism is to allow nonterminals to have arguments, the values of which are passed along within the rules. This allows natural language features such as agreement and reference, and programming language analogs such as the correct use and definition of identifiers, to be expressed in a natural way. E.g. we can now easily express that in English sentences, the subject and verb must agree in number.

    In computer science, examples of this approach include affix grammars, attribute grammars, indexed grammars, and Van Wijngaarden two-level grammars.

    Similar extensions exist in linguistics.

    Another extension is to allow additional symbols to appear at the left hand side of rules, constraining their application. This produces the formalism of context-sensitive grammars.

    Linguistic applications

    Chomsky initially hoped to overcome the limitations of context-free grammars by adding transformation rules.

    Such rules are another standard device in traditional linguistics; e.g. passivization in English. However, arbitrary transformations must be disallowed, since they are much too powerful (Turing complete). Much of generative grammar has been devoted to finding ways of refining the descriptive mechanisms of phrase-structure grammar and transformation rules such that exactly the kinds of things can be expressed that natural language actually allows.

    His general position regarding the non-context-freeness of natural language has held up since then, although his specific examples regarding the inadequacy of context free grammars (CFGs) in terms of their weak generative capacity were later disproved. Gerald Gazdar and Geoffrey Pullum have argued that despite a few non-context-free constructions in natural language (such as cross-serial dependencies in Swiss German and reduplication in Bambara, the vast majority of forms in natural language are indeed context-free.

    Äänestä

  • PS-slogan kirjoitti:

    "Irrallaan konktekstista" (context-free) ilmiötä on tutkittu. Siinä on kiteytetty hyvin PersS:n politiikan pääpiirteet:

    A context-free language in the political subtance:

    where

    1. is a finite set of non-terminal characters or variables. They represent different types of phrase or clause in the sentence.

    2. is a finite set of terminals, disjoint with , which make up the actual content of the sentence.

    3. is a relation from to such that .

    4. is the start variable, used to represent the whole sentence (or program). It must be an element of .

    In addition, is a finite set. The members of are called the rules or productions of the grammar. The asterisk represents the Kleene star operation.

    Additional Definition 1

    For any strings , we say yields , written as , if such that and . Thus, is the result of applying the rule to .

    Additional Definition 2

    For any (or in some textbooks) if such that

    Additional Definition 3

    The language of a grammar is the set


    Additional Definition 4

    A language is said to be a context-free language (CFL) if there exists a CFG, such that .

    Additional Definition 5

    A context-free grammar is said to be proper if it has:
    no useless symbols (inaccesible symbols or unproductive symbols)
    no ε-productions
    no cycles

    Examples

    Example 1
    S → a
    S → aS
    S → bS

    The terminals here are a and b, while the only non-terminal is S. The language described is all nonempty strings of as and bs that end in a.

    This grammar is regular: no rule has more than one nonterminal in its right-hand side, and each of these nonterminals is at the same end of the right-hand side.

    Every regular grammar corresponds directly to a nondeterministic finite automaton, so we know that this is a regular language.

    It is common to list all right-hand sides for the same left-hand side on the same line, using | to separate them, like this:
    S → a | aS | bS

    Technically, this is the same grammar as above.

    Example 2

    In a context-free grammar, we can pair up characters the way we do with brackets. The simplest example:
    S → aSb
    S → ab

    This grammar generates the language , which is not regular.

    The special character ε stands for the empty string. By changing the above grammar to :S → aSb | ε we obtain a grammar generating the language instead. This differs only in that it contains the empty string while the original grammar did not.

    Example 3

    Here is a context-free grammar for syntactically correct infix algebraic expressions in the variables x, y and z:
    S → x | y | z | S S | S - S | S * S | S/S | (S)

    This grammar can, for example, generate the string "( x y ) * x - z * y / ( x x )" as follows: "S" is the initial string. "S - S" is the result of applying the fifth transformation [S → S - S] to the nonterminal S. "S * S - S / S" is the result of applying the sixth transform to the first S and the seventh one to the second S. "( S ) * S - S / ( S )" is the result of applying the final transform to certain of the nonterminals. "( S S ) * S - S * S / ( S S )" is the result of the fourth and fifth transforms to certain nonterminals. "( x y ) * x - z * y / ( x x )" is the final result, obtained by using the first three transformations to turn the S nonterminals into the terminals x, y, and z.

    This grammar is ambiguous, meaning that one can generate the same string with more than one parse tree. For example, "x y * z" might have either the or the * parsed first; presumably these will produce different results. However, the language being described is not itself ambiguous: a different, unambiguous grammar can be written for it.

    Example 4

    A context-free grammar for the language consisting of all strings over {a,b} for which the number of a's and b's are different is
    S → U | V
    U → TaU | TaT
    V → TbV | TbT
    T → aTbT | bTaT | ε

    Here, the nonterminal T can generate all strings with the same number of a's as b's, the nonterminal U generates all strings with more a's than b's and the nonterminal V generates all strings with fewer a's than b's.

    Example 5

    Another example of a non-regular language is . It is context-free as it can be generated by the following context-free grammar:
    S → bSbb | A
    A → aA | ε

    Other examples

    Context-free grammars are not limited in application to mathematical ("formal") languages. For example, it has been suggested that a class of Tamil poetry called Venpa is described by a context-free grammar.[2]

    Derivations and syntax trees

    There are two common ways to describe how a given string can be derived from the start symbol of a given grammar. The simplest way is to list the consecutive strings of symbols, beginning with the start symbol and ending with the string, and the rules that have been applied. If we introduce a strategy such as "always replace the left-most nonterminal first" then for context-free grammars the list of applied grammar rules is by itself sufficient. This is called the leftmost derivation of a string. For example, if we take the following grammar:
    (1) S → S S
    (2) S → 1
    (3) S → a

    and the string "1 1 a" then a left derivation of this string is the list [ (1), (1), (2), (2), (3) ]. Analogously the rightmost derivation is defined as the list that we get if we always replace the rightmost nonterminal first. In this case this could be the list [ (1), (3), (1), (2), (2)].

    The distinction between leftmost derivation and rightmost derivation is important because in most parsers the transformation of the input is defined by giving a piece of code for every grammar rule that is executed whenever the rule is applied. Therefore it is important to know whether the parser determines a leftmost or a rightmost derivation because this determines the order in which the pieces of code will be executed. See for an example LL parsers and LR parsers.

    A derivation also imposes in some sense a hierarchical structure on the string that is derived. For example, if the string "1 1 a" is derived according to the leftmost derivation:
    S → S S (1)
    → S S S (1)
    → 1 S S (2)
    → 1 1 S (2)
    → 1 1 a (3)

    the structure of the string would be:
    { { { 1 }S { 1 }S }S { a }S }S

    where { ... }S indicates a substring recognized as belonging to S. This hierarchy can also be seen as a tree:
    S
    /|\
    / | \
    / | \
    S ' ' S
    /|\ |
    / | \ |
    S ' ' S 'a'
    | |
    '1' '1'

    This tree is called a concrete syntax tree (see also abstract syntax tree) of the string. In this case the presented leftmost and the rightmost derivations define the same syntax tree; however, there is another (leftmost) derivation of the same string
    S → S S (1)
    → 1 S (2)
    → 1 S S (1)
    → 1 1 S (2)
    → 1 1 a (3)

    and this defines the following syntax tree:
    S
    /|\
    / | \
    / | \
    S ' ' S
    | /|\
    | / | \
    '1' S ' ' S
    | |
    '1' 'a'

    If, for certain strings in the language of the grammar, there is more than one parsing tree, then the grammar is said to be an ambiguous grammar. Such grammars are usually hard to parse because the parser cannot always decide which grammar rule it has to apply. Usually, ambiguity is a feature of the grammar, not the language, and an unambiguous grammar can be found which generates the same context-free language. However, there are certain languages which can only be generated by ambiguous grammars; such languages are called inherently ambiguous.

    Normal forms

    Every context-free grammar that does not generate the empty string can be transformed into one in which no rule has the empty string as a product [a rule with ε as a product is called an ε-production]. If it does generate the empty string, it will be necessary to include the rule , but there need be no other ε-rule. Every context-free grammar with no ε-production has an equivalent grammar in Chomsky normal form or Greibach normal form. "Equivalent" here means that the two grammars generate the same language.

    Because of the especially simple form of production rules in Chomsky Normal Form grammars, this normal form has both theoretical and practical implications. For instance, given a context-free grammar, one can use the Chomsky Normal Form to construct a polynomial-time algorithm which decides whether a given string is in the language represented by that grammar or not (the CYK algorithm).

    Undecidable problems

    Although some operations on context-free grammars are decidable, due to their limited power, CFGs do have interesting undecidable problems. One of the simplest and most cited is the problem of deciding whether a CFG accepts the language of all strings. A reduction can be demonstrated to this problem from the well-known undecidable problem of determining whether a Turing machine accepts a particular input (the Halting problem). The reduction uses the concept of a computation history, a string describing an entire computation of a Turing machine. We can construct a CFG that generates all strings that are not accepting computation histories for a particular Turing machine on a particular input, and thus it will accept all strings only if the machine does not accept that input.

    As a consequence of this, it is also undecidable whether two CFGs describe the same language, since we can't even decide whether a CFG is equivalent to the trivial CFG deciding the language of all strings.

    Another point worth mentioning is that the problem of determining if a context-sensitive grammar describes a context-free language is undecidable.

    Extensions

    An obvious way to extend the context-free grammar formalism is to allow nonterminals to have arguments, the values of which are passed along within the rules. This allows natural language features such as agreement and reference, and programming language analogs such as the correct use and definition of identifiers, to be expressed in a natural way. E.g. we can now easily express that in English sentences, the subject and verb must agree in number.

    In computer science, examples of this approach include affix grammars, attribute grammars, indexed grammars, and Van Wijngaarden two-level grammars.

    Similar extensions exist in linguistics.

    Another extension is to allow additional symbols to appear at the left hand side of rules, constraining their application. This produces the formalism of context-sensitive grammars.

    Linguistic applications

    Chomsky initially hoped to overcome the limitations of context-free grammars by adding transformation rules.

    Such rules are another standard device in traditional linguistics; e.g. passivization in English. However, arbitrary transformations must be disallowed, since they are much too powerful (Turing complete). Much of generative grammar has been devoted to finding ways of refining the descriptive mechanisms of phrase-structure grammar and transformation rules such that exactly the kinds of things can be expressed that natural language actually allows.

    His general position regarding the non-context-freeness of natural language has held up since then, although his specific examples regarding the inadequacy of context free grammars (CFGs) in terms of their weak generative capacity were later disproved. Gerald Gazdar and Geoffrey Pullum have argued that despite a few non-context-free constructions in natural language (such as cross-serial dependencies in Swiss German and reduplication in Bambara, the vast majority of forms in natural language are indeed context-free.

    Soini tarkoittaa höpöttäessään "irrallaan kontekstista". Oheinen kaava kannattaa todellakin ottaa peruSS:n seuraavan vaaliohjelman rungoksi?

    Äänestä

  • sana keksitty kirjoitti:

    rahvaan ihmeteltäväksi, tässä taustaa -

    http://fi.wiktionary.org/wiki/konteksti

    Mistä asiayhteydestä tämä päähänampuminen on irroitettu kuka kertois sen

    Äänestä

  • yllämainittua kirjoitti:

    Soini tarkoittaa höpöttäessään "irrallaan kontekstista". Oheinen kaava kannattaa todellakin ottaa peruSS:n seuraavan vaaliohjelman rungoksi?

    Soinin Eurovaaliohjelma:


    Soini
    /|\
    PerusS
    /|\
    / | \
    / | \
    S ' ' S
    /|\ |
    / | \ |
    S ' ' S 'a'
    | |
    '1' '1'

    Äänestä

  • PS-slogan kirjoitti:

    "Irrallaan konktekstista" (context-free) ilmiötä on tutkittu. Siinä on kiteytetty hyvin PersS:n politiikan pääpiirteet:

    A context-free language in the political subtance:

    where

    1. is a finite set of non-terminal characters or variables. They represent different types of phrase or clause in the sentence.

    2. is a finite set of terminals, disjoint with , which make up the actual content of the sentence.

    3. is a relation from to such that .

    4. is the start variable, used to represent the whole sentence (or program). It must be an element of .

    In addition, is a finite set. The members of are called the rules or productions of the grammar. The asterisk represents the Kleene star operation.

    Additional Definition 1

    For any strings , we say yields , written as , if such that and . Thus, is the result of applying the rule to .

    Additional Definition 2

    For any (or in some textbooks) if such that

    Additional Definition 3

    The language of a grammar is the set


    Additional Definition 4

    A language is said to be a context-free language (CFL) if there exists a CFG, such that .

    Additional Definition 5

    A context-free grammar is said to be proper if it has:
    no useless symbols (inaccesible symbols or unproductive symbols)
    no ε-productions
    no cycles

    Examples

    Example 1
    S → a
    S → aS
    S → bS

    The terminals here are a and b, while the only non-terminal is S. The language described is all nonempty strings of as and bs that end in a.

    This grammar is regular: no rule has more than one nonterminal in its right-hand side, and each of these nonterminals is at the same end of the right-hand side.

    Every regular grammar corresponds directly to a nondeterministic finite automaton, so we know that this is a regular language.

    It is common to list all right-hand sides for the same left-hand side on the same line, using | to separate them, like this:
    S → a | aS | bS

    Technically, this is the same grammar as above.

    Example 2

    In a context-free grammar, we can pair up characters the way we do with brackets. The simplest example:
    S → aSb
    S → ab

    This grammar generates the language , which is not regular.

    The special character ε stands for the empty string. By changing the above grammar to :S → aSb | ε we obtain a grammar generating the language instead. This differs only in that it contains the empty string while the original grammar did not.

    Example 3

    Here is a context-free grammar for syntactically correct infix algebraic expressions in the variables x, y and z:
    S → x | y | z | S S | S - S | S * S | S/S | (S)

    This grammar can, for example, generate the string "( x y ) * x - z * y / ( x x )" as follows: "S" is the initial string. "S - S" is the result of applying the fifth transformation [S → S - S] to the nonterminal S. "S * S - S / S" is the result of applying the sixth transform to the first S and the seventh one to the second S. "( S ) * S - S / ( S )" is the result of applying the final transform to certain of the nonterminals. "( S S ) * S - S * S / ( S S )" is the result of the fourth and fifth transforms to certain nonterminals. "( x y ) * x - z * y / ( x x )" is the final result, obtained by using the first three transformations to turn the S nonterminals into the terminals x, y, and z.

    This grammar is ambiguous, meaning that one can generate the same string with more than one parse tree. For example, "x y * z" might have either the or the * parsed first; presumably these will produce different results. However, the language being described is not itself ambiguous: a different, unambiguous grammar can be written for it.

    Example 4

    A context-free grammar for the language consisting of all strings over {a,b} for which the number of a's and b's are different is
    S → U | V
    U → TaU | TaT
    V → TbV | TbT
    T → aTbT | bTaT | ε

    Here, the nonterminal T can generate all strings with the same number of a's as b's, the nonterminal U generates all strings with more a's than b's and the nonterminal V generates all strings with fewer a's than b's.

    Example 5

    Another example of a non-regular language is . It is context-free as it can be generated by the following context-free grammar:
    S → bSbb | A
    A → aA | ε

    Other examples

    Context-free grammars are not limited in application to mathematical ("formal") languages. For example, it has been suggested that a class of Tamil poetry called Venpa is described by a context-free grammar.[2]

    Derivations and syntax trees

    There are two common ways to describe how a given string can be derived from the start symbol of a given grammar. The simplest way is to list the consecutive strings of symbols, beginning with the start symbol and ending with the string, and the rules that have been applied. If we introduce a strategy such as "always replace the left-most nonterminal first" then for context-free grammars the list of applied grammar rules is by itself sufficient. This is called the leftmost derivation of a string. For example, if we take the following grammar:
    (1) S → S S
    (2) S → 1
    (3) S → a

    and the string "1 1 a" then a left derivation of this string is the list [ (1), (1), (2), (2), (3) ]. Analogously the rightmost derivation is defined as the list that we get if we always replace the rightmost nonterminal first. In this case this could be the list [ (1), (3), (1), (2), (2)].

    The distinction between leftmost derivation and rightmost derivation is important because in most parsers the transformation of the input is defined by giving a piece of code for every grammar rule that is executed whenever the rule is applied. Therefore it is important to know whether the parser determines a leftmost or a rightmost derivation because this determines the order in which the pieces of code will be executed. See for an example LL parsers and LR parsers.

    A derivation also imposes in some sense a hierarchical structure on the string that is derived. For example, if the string "1 1 a" is derived according to the leftmost derivation:
    S → S S (1)
    → S S S (1)
    → 1 S S (2)
    → 1 1 S (2)
    → 1 1 a (3)

    the structure of the string would be:
    { { { 1 }S { 1 }S }S { a }S }S

    where { ... }S indicates a substring recognized as belonging to S. This hierarchy can also be seen as a tree:
    S
    /|\
    / | \
    / | \
    S ' ' S
    /|\ |
    / | \ |
    S ' ' S 'a'
    | |
    '1' '1'

    This tree is called a concrete syntax tree (see also abstract syntax tree) of the string. In this case the presented leftmost and the rightmost derivations define the same syntax tree; however, there is another (leftmost) derivation of the same string
    S → S S (1)
    → 1 S (2)
    → 1 S S (1)
    → 1 1 S (2)
    → 1 1 a (3)

    and this defines the following syntax tree:
    S
    /|\
    / | \
    / | \
    S ' ' S
    | /|\
    | / | \
    '1' S ' ' S
    | |
    '1' 'a'

    If, for certain strings in the language of the grammar, there is more than one parsing tree, then the grammar is said to be an ambiguous grammar. Such grammars are usually hard to parse because the parser cannot always decide which grammar rule it has to apply. Usually, ambiguity is a feature of the grammar, not the language, and an unambiguous grammar can be found which generates the same context-free language. However, there are certain languages which can only be generated by ambiguous grammars; such languages are called inherently ambiguous.

    Normal forms

    Every context-free grammar that does not generate the empty string can be transformed into one in which no rule has the empty string as a product [a rule with ε as a product is called an ε-production]. If it does generate the empty string, it will be necessary to include the rule , but there need be no other ε-rule. Every context-free grammar with no ε-production has an equivalent grammar in Chomsky normal form or Greibach normal form. "Equivalent" here means that the two grammars generate the same language.

    Because of the especially simple form of production rules in Chomsky Normal Form grammars, this normal form has both theoretical and practical implications. For instance, given a context-free grammar, one can use the Chomsky Normal Form to construct a polynomial-time algorithm which decides whether a given string is in the language represented by that grammar or not (the CYK algorithm).

    Undecidable problems

    Although some operations on context-free grammars are decidable, due to their limited power, CFGs do have interesting undecidable problems. One of the simplest and most cited is the problem of deciding whether a CFG accepts the language of all strings. A reduction can be demonstrated to this problem from the well-known undecidable problem of determining whether a Turing machine accepts a particular input (the Halting problem). The reduction uses the concept of a computation history, a string describing an entire computation of a Turing machine. We can construct a CFG that generates all strings that are not accepting computation histories for a particular Turing machine on a particular input, and thus it will accept all strings only if the machine does not accept that input.

    As a consequence of this, it is also undecidable whether two CFGs describe the same language, since we can't even decide whether a CFG is equivalent to the trivial CFG deciding the language of all strings.

    Another point worth mentioning is that the problem of determining if a context-sensitive grammar describes a context-free language is undecidable.

    Extensions

    An obvious way to extend the context-free grammar formalism is to allow nonterminals to have arguments, the values of which are passed along within the rules. This allows natural language features such as agreement and reference, and programming language analogs such as the correct use and definition of identifiers, to be expressed in a natural way. E.g. we can now easily express that in English sentences, the subject and verb must agree in number.

    In computer science, examples of this approach include affix grammars, attribute grammars, indexed grammars, and Van Wijngaarden two-level grammars.

    Similar extensions exist in linguistics.

    Another extension is to allow additional symbols to appear at the left hand side of rules, constraining their application. This produces the formalism of context-sensitive grammars.

    Linguistic applications

    Chomsky initially hoped to overcome the limitations of context-free grammars by adding transformation rules.

    Such rules are another standard device in traditional linguistics; e.g. passivization in English. However, arbitrary transformations must be disallowed, since they are much too powerful (Turing complete). Much of generative grammar has been devoted to finding ways of refining the descriptive mechanisms of phrase-structure grammar and transformation rules such that exactly the kinds of things can be expressed that natural language actually allows.

    His general position regarding the non-context-freeness of natural language has held up since then, although his specific examples regarding the inadequacy of context free grammars (CFGs) in terms of their weak generative capacity were later disproved. Gerald Gazdar and Geoffrey Pullum have argued that despite a few non-context-free constructions in natural language (such as cross-serial dependencies in Swiss German and reduplication in Bambara, the vast majority of forms in natural language are indeed context-free.

    Tapahtumat viime aikoina osoittavat selkeästi, että rotuviha asettaa tahomme tukalaan tilanteeseen ajateltaessa vastuunalaisia kontradiktioita. Ehkä kognitiivisuus yksinkertaistaa tulevaa kansallista ja omaleimaista behaviorismiamme. Mutta universaalista näkökulmasta katsoen tilanteen evaluointi panostaa interaktiivisuuteen ajattelematta isänmaallisten tahojen yhteistyön kariutumisesta aiheutuvia hyökyaaltoja poliittisella ja sosiaalisella areenalla..... etc

    Äänestä

Kommentoi aloitusta


PS-slogan kirjoitti:

Halla-aholaisten lanseeraama ”irrallaan kontekstista” sopisi hyvin PerusS:n puolueohjelmaksi.

Mitään muuta ei tarvita.

Anonyymi
5000

Ilmoita asiaton sisältö

  • Sisältää materiaalia, joka on loukkaavaa, herjaavaa, rasistista, uhkailevaa tai ahdistelevaa.

  • Materiaali sisältää nimiä, yhteystietoja tai muita henkilökohtaisia tietoja. Julkisuuden henkilöistä, julkisissa viroissa toimivista ihmisistä sekä yritysten vastuuhenkilöistä saa keskustella työhön liittyen. Myös yksityiselämään liittyvistä asioista voi keskustella siltä osin, kuin niistä on julkisesti kerrottu.

  • Sisältää lapsille haitallista tai heiltä kiellettyä materiaalia. Seksuaalinen sisältö on sallittua aiheeseen tarkoitetuilla palstoilla, joiden ikäraja on 18 vuotta.

  • Lainvastaista sisältöä voi olla mm. yksityiselämää loukkaavan tiedon levitys, kiihottaminen kansanryhmää vastaan, laiton uhkaaminen, alaikäisiin liittyvä seksuaalinen sisältö/grooming, petokset, identiteettivarkaudet, kunnianloukkaukset ja tekijänoikeusrikkomukset.

  • Sisältö ei liity palstan tai keskusteluketjun aiheeseen.

  • Viesti ei ole suomea tai ruotsia (pl. International Forums), se sisältää mainontaa, se sisältää tekijänoikeuksin suojattua materiaalia, se on massapostitus tai jokin muu syy.

Jaa keskustelu