YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
  • Formal languages aFrom Wikipedia, the free encyclopedia

  • Contents

    1 Abstract family of acceptors 11.1 Formal definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.1.1 AFA Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1.2 Abstract family of acceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.2 Informal discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1 AFA Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.2 Abstract family of acceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.3 Results from AFL theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Origins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    2 Abstract family of languages 32.1 Formal definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Some families of languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.3 Origins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.4 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    3 Abstract rewriting system 53.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.2 Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.3 Basic notions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.4 Normal forms and the word problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.5 Joinability and the ChurchRosser property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.6 Notions of confluence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.7 Termination and convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.8 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.9 Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.10 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    4 Abstract semantic graph 104.1 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.2 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    i

  • ii CONTENTS

    4.3 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    5 Abstract syntax tree 125.1 Application in compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    5.1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125.1.2 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145.1.3 Design patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145.1.4 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    5.2 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.4 Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.5 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    6 Action algebra 166.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176.4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    7 Adaptive grammar 187.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    7.1.1 Early history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187.1.2 Collaborative efforts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187.1.3 Terminology and taxonomy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    7.2 Adaptive formalisms in the literature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197.2.1 Adaptive grammar formalisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197.2.2 Adaptive machine formalisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    7.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.4 References and notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.5 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    8 Affix grammar 238.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238.2 Types of affix grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248.4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    9 Agent Communications Language 259.1 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    10 Algorithmic learning theory 2610.1 Distinguishing Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2610.2 Learning in the limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2610.3 Other Identification Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

  • CONTENTS iii

    10.4 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2710.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2710.6 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    11 Alphabet (formal languages) 2911.1 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2911.2 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2911.3 Literature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    12 Ambiguous grammar 3012.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    12.1.1 Trivial language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3012.1.2 Unary string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3112.1.3 Addition and subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3112.1.4 Dangling else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    12.2 Recognizing ambiguous grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3212.3 Inherently ambiguous languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3212.4 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3212.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3212.6 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    13 Antimatroid 3413.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3513.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3513.3 Paths and basic words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3613.4 Convex geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3713.5 Join-distributive lattices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3713.6 Supersolvable antimatroids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3813.7 Join operation and convex dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3813.8 Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3913.9 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3913.10Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3913.11References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    14 Aperiodic finite state automaton 4114.1 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4114.2 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    15 Ardens Rule 4215.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4215.2 Statement of Ardens rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4215.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4215.4 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

  • iv CONTENTS

    15.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    16 Attribute grammar 4316.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4316.2 Synthesized attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4316.3 Inherited attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4416.4 Special types of attribute grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4416.5 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4416.6 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    17 Augmented BackusNaur Form 4517.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4517.2 Terminal values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4517.3 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    17.3.1 White space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4617.3.2 Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4617.3.3 Concatenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4617.3.4 Alternative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4617.3.5 Incremental alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4617.3.6 Value range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4717.3.7 Sequence group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4717.3.8 Variable repetition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4717.3.9 Specific repetition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4717.3.10 Optional sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4717.3.11 Operator precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4817.3.12 Core rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

    17.4 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4817.5 Pitfalls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4817.6 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4817.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4817.8 Text and image sources, contributors, and licenses . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    17.8.1 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5017.8.2 Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5117.8.3 Content license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

  • Chapter 1

    Abstract family of acceptors

    An abstract family of acceptors (AFA) is a grouping of generalized acceptors. Informally, an acceptor is a devicewith a finite state control, a finite number of input symbols, and an internal store with a read and write function. Eachacceptor has a start state and a set of accepting states. The device reads a sequence of symbols, transitioning fromstate to state for each input symbol. If the device ends in an accepting state, the device is said to accept the sequenceof symbols. A family of acceptors is a set of acceptors with the same type of internal store. The study of AFA ispart of AFL (abstract families of languages) theory. [1]

    1.1 Formal definitions

    1.1.1 AFA Schema

    An AFA Schema is an ordered 4-tuple (, I, f, g) , where

    1. and I are nonempty abstract sets.

    2. f is the write function: f : I {} (N.B. * is the Kleene star operation).

    3. g is the read function, a mapping from into the finite subsets of , such that g() = {} and is in g()if and only if = . (N.B. is the empty word).

    4. For each in g() , there is an element 1 in I satisfying f(, 1) = for all such that is in g() .

    5. For each u in I, there exists a finite set u , such that if 1 , is in 1 , and f(, u) = , then f(, u)is in (1 u) .

    1.1.2 Abstract family of acceptors

    An abstract family of acceptors (AFA) is an ordered pair (,D) such that:

    1. is an ordered 6-tuple ( K , , , I , f , g ), where

    (a) ( , I , f , g ) is an AFA schema; and(b) K and are infinite abstract sets

    2. D is the family of all acceptors D = ( K1 , 1 , , q0 , F ), where

    (a) K1 and 1 are finite subsets of K , and respectively, F K1 , and q0 is in K1 ; and(b) (called the transition function) is a mapping from K1 (1 {}) g() into the finite subsets of

    K1 I such that the set GD = { | (q, a, ) for some q and a} is finite.

    1

    https://en.wikipedia.org/wiki/Finite_state_machine#Acceptors_and_recognizershttps://en.wikipedia.org/wiki/Abstract_family_of_languageshttps://en.wikipedia.org/wiki/Kleene_star
  • 2 CHAPTER 1. ABSTRACT FAMILY OF ACCEPTORS

    For a given acceptor, let be the relation on K1 1 defined by: For a in 1 {} , (p, aw, ) (p, w, )if there exists a and u such that is in g() , (p, u) is in (p, a, ) and f(, u) = . Let denote the transitiveclosure of .Let (,D) be an AFA and D = ( K1 , 1 , , q0 , F ) be in D . Define L(D) to be the set {w 1|q F.(q0, w, ) (q, , )} . For each subset E of D , let L(E) = {L(D)|D E} .Define Lf (D) to be the set {w 1|(q F )( ).(q0, w, ) (q, , )} . For each subset E of D , letLf (E) = {Lf (D)|D E} .

    1.2 Informal discussion

    1.2.1 AFA Schema

    An AFA schema defines a store or memory with read and write function. The symbols in are called storage symbolsand the symbols in I are called instructions. The write function f returns a new storage state given the current storagestate and an instruction. The read function g returns the current state of memory. Condition (3) insures the emptystorage configuration is distinct from other configurations. Condition (4) requires there be an identity instruction thatallows the state of memory to remain unchanged while the acceptor changes state or advances the input. Condition(5) assures that the set of storage symbols for any given acceptor is finite.

    1.2.2 Abstract family of acceptors

    An AFA is the set of all acceptors over a given pair of state and input alphabets which have the same storage mech-anism defined by a given AFA schema. The relation defines one step in the operation of an acceptor. Lf (D) isthe set of words accepted by acceptor D by having the acceptor enter an accepting state. L(D) is the set of wordsaccepted by acceptor D by having the acceptor simultaneously enter an accepting state and having an empty storage.The abstract acceptors defined by AFA are generalizations of other types of acceptors (e.g. finite state automata,pushdown automata, etc.). They have a finite state control like other automata, but their internal storage may varywidely from the stacks and tapes used in classical automata.

    1.3 Results from AFL theory

    The main result from AFL theory is that a family of languages L is a full AFL if and only if L = L(D) for someAFA (,D) . Equally important is the result that L is a full semi-AFL if and only if L = Lf (D) for some AFA(,D) .

    1.4 Origins

    Seymour Ginsburg of the University of Southern California and Sheila Greibach of Harvard University first presentedtheir AFL theory paper at the IEEE Eighth Annual Symposium on Switching and Automata Theory in 1967.[2]

    1.5 References[1] Seymour Ginsburg, Algebraic and automata theoretic properties of formal languages, North-Holland, 1975, ISBN 0-7204-

    2506-9.

    [2] IEEE conference record of 1967 Eighth Annual Symposium on Switching and Automata Theory : papers presented at theEighth Annual Symposium, University of Texas, October 18-20, 1967.

    https://en.wikipedia.org/wiki/Transitive_closurehttps://en.wikipedia.org/wiki/Transitive_closurehttps://en.wikipedia.org/wiki/Finite_state_automatahttps://en.wikipedia.org/wiki/Pushdown_automatahttps://en.wikipedia.org/wiki/Seymour_Ginsburghttps://en.wikipedia.org/wiki/University_of_Southern_Californiahttps://en.wikipedia.org/wiki/Sheila_Greibachhttps://en.wikipedia.org/wiki/Harvard_Universityhttps://en.wikipedia.org/wiki/IEEEhttps://en.wikipedia.org/wiki/Seymour_Ginsburghttps://en.wikipedia.org/wiki/Special:BookSources/0720425069https://en.wikipedia.org/wiki/Special:BookSources/0720425069http://www.worldcat.org/oclc/2891921
  • Chapter 2

    Abstract family of languages

    In computer science, in particular in the field of formal language theory, the term abstract family of languages refersto an abstract mathematical notion generalizing characteristics common to the regular languages, the context-freelanguages and the recursively enumerable languages, and other families of formal languages studied in the scientificliterature.

    2.1 Formal definitions

    A formal language is a set L for which there exists a finite set of abstract symbols such that L , where * isthe Kleene star operation.A family of languages is an ordered pair (,) , where

    1. is an infinite set of symbols;

    2. is a set of formal languages;

    3. For each L in there exists a finite subset 1 such that L 1 ; and

    4. L for some L in .

    A trio is a family of languages closed under e-free homomorphism, inverse homomorphism, and intersection withregular language.A full trio, also called a cone, is a trio closed under arbitrary homomorphism.A (full) semi-AFL is a (full) trio closed under union.A (full) AFL is a (full) semi-AFL closed under concatenation and the Kleene plus.

    2.2 Some families of languages

    The following are some simple results from the study of abstract families of languages.[1][2]

    Within the Chomsky hierarchy, the regular languages, the context-free languages, and the recursively enumerablelanguages are all full AFLs. However, the context sensitive languages and the recursive languages are AFLs, but notfull AFLs because they are not closed under arbitrary homomorphisms.The family of regular languages are contained within any cone (full trio). Other categories of abstract families areidentifiable by closure under other operations such as shuffle, reversal, or substitution.[3]

    3

    https://en.wikipedia.org/wiki/Computer_sciencehttps://en.wikipedia.org/wiki/Formal_languagehttps://en.wikipedia.org/wiki/Regular_languagehttps://en.wikipedia.org/wiki/Context-free_languagehttps://en.wikipedia.org/wiki/Context-free_languagehttps://en.wikipedia.org/wiki/Recursively_enumerable_languagehttps://en.wikipedia.org/wiki/Formal_languagehttps://en.wikipedia.org/wiki/Kleene_starhttps://en.wikipedia.org/wiki/Closure_(mathematics)https://en.wikipedia.org/wiki/E-free_homomorphismhttps://en.wikipedia.org/wiki/Homomorphismhttps://en.wikipedia.org/wiki/Regular_languagehttps://en.wikipedia.org/wiki/Cone_(formal_languages)https://en.wikipedia.org/wiki/Union_(set_theory)https://en.wikipedia.org/wiki/Concatenationhttps://en.wikipedia.org/wiki/Kleene_plushttps://en.wikipedia.org/wiki/Chomsky_hierarchyhttps://en.wikipedia.org/wiki/Regular_languagehttps://en.wikipedia.org/wiki/Context-free_languagehttps://en.wikipedia.org/wiki/Recursively_enumerable_languagehttps://en.wikipedia.org/wiki/Recursively_enumerable_languagehttps://en.wikipedia.org/wiki/Context-sensitive_languagehttps://en.wikipedia.org/wiki/Recursive_language
  • 4 CHAPTER 2. ABSTRACT FAMILY OF LANGUAGES

    2.3 Origins

    Seymour Ginsburg of the University of Southern California and Sheila Greibach of Harvard University presented thefirst AFL theory paper at the IEEE Eighth Annual Symposium on Switching and Automata Theory in 1967.[4]

    2.4 Notes[1] Ginsburg (1975)

    [2] Mateescu, A.; Salomaa, A. (2001), Abstract family of languages, in Hazewinkel, Michiel, Encyclopedia of Mathematics,Springer, ISBN 978-1-55608-010-4

    [3] Pun, Gh. (2001), AFL operations, in Hazewinkel, Michiel, Encyclopedia of Mathematics, Springer, ISBN 978-1-55608-010-4

    [4] Ginsburg & Greibach (1967)

    2.5 References Ginsburg, Seymour; Greibach, Sheila (1967). Abstract Families of Languages. Conference Record of 1967Eighth Annual Symposium on Switching and Automata Theory, 18-20 October 1967, Austin, Texas, USA. IEEE.pp. 128139.

    Seymour Ginsburg, Algebraic and automata theoretic properties of formal languages, North-Holland, 1975,ISBN 0-7204-2506-9.

    John E. Hopcroft and Jeffrey D. Ullman, Introduction to Automata Theory, Languages, and Computation,Addison-Wesley Publishing, Reading Massachusetts, 1979. ISBN 0-201-02988-X. Chapter 11: Closure prop-erties of families of languages.

    Mateescu, Alexandru; Salomaa, Arto (1997). Chapter 4: Aspects of Classical Language Theory. In Rozen-berg, Grzegorz; Salomaa, Arto. Handbook of Formal Languages. Volume I: Word, language, grammar.Springer-Verlag. pp. 175252. ISBN 3-540-61486-9.

    https://en.wikipedia.org/wiki/Seymour_Ginsburghttps://en.wikipedia.org/wiki/University_of_Southern_Californiahttps://en.wikipedia.org/wiki/Sheila_Greibachhttps://en.wikipedia.org/wiki/Harvard_Universityhttps://en.wikipedia.org/wiki/Symposium_on_Switching_and_Automata_Theoryhttps://en.wikipedia.org/wiki/Abstract_family_of_languages#CITEREFGinsburg1975http://www.encyclopediaofmath.org/index.php?title=Abstract_family_of_languageshttps://en.wikipedia.org/wiki/Encyclopedia_of_Mathematicshttps://en.wikipedia.org/wiki/Springer_Science+Business_Mediahttps://en.wikipedia.org/wiki/International_Standard_Book_Numberhttps://en.wikipedia.org/wiki/Special:BookSources/978-1-55608-010-4http://www.encyclopediaofmath.org/index.php?title=AFL_operationshttps://en.wikipedia.org/wiki/Encyclopedia_of_Mathematicshttps://en.wikipedia.org/wiki/Springer_Science+Business_Mediahttps://en.wikipedia.org/wiki/International_Standard_Book_Numberhttps://en.wikipedia.org/wiki/Special:BookSources/978-1-55608-010-4https://en.wikipedia.org/wiki/Special:BookSources/978-1-55608-010-4https://en.wikipedia.org/wiki/Abstract_family_of_languages#CITEREFGinsburgGreibach1967https://en.wikipedia.org/wiki/Seymour_Ginsburghttps://en.wikipedia.org/wiki/Special:BookSources/0720425069https://en.wikipedia.org/wiki/Introduction_to_Automata_Theory,_Languages,_and_Computationhttps://en.wikipedia.org/wiki/Special:BookSources/020102988Xhttps://en.wikipedia.org/wiki/International_Standard_Book_Numberhttps://en.wikipedia.org/wiki/Special:BookSources/3-540-61486-9
  • Chapter 3

    Abstract rewriting system

    In mathematical logic and theoretical computer science, an abstract rewriting system (also (abstract) reductionsystem or abstract rewrite system; abbreviation ARS) is a formalism that captures the quintessential notion andproperties of rewriting systems. In its simplest form, an ARS is simply a set (of objects) together with a binaryrelation, traditionally denoted with ; this definition can be further refined if we index (label) subsets of the binaryrelation. Despite its simplicity, an ARS is sufficient to describe important properties of rewriting systems like normalforms, termination, and various notions of confluence.Historically, there have been several formalizations of rewriting in an abstract setting, each with its idiosyncrasies.This is due in part to the fact that some notions are equivalent, see below in this article. The formalization that ismost commonly encountered in monographs and textbooks, and which is generally followed here, is due to GrardHuet (1980).[1]

    3.1 Definition

    Abstract reduction system, (abbreviated ARS) is the most general (unidimensional) notion about specifying a setof objects and rules that can be applied to transform them. More recently authors use abstract rewriting system aswell.[2] (The preference for the word reduction here instead of rewriting constitutes a departure from the uniformuse of rewriting in the names of systems that are particularizations of ARS. Because the word reduction does notappear in the names of more specialized systems, in older texts reduction system is a synonym for ARS).[3]

    An ARS is a setA, whose elements are usually called objects, together with a binary relation onA, traditionally denotedby , and called the reduction relation, rewrite relation[4] or just reduction.[5] This (entrenched) terminology usingreduction is a little misleading, because the relation is not necessarily reducing some measure of the objects.In some contexts it may be beneficial to distinguish between some subsets of the rules, i.e. some subsets of the reduc-tion relation , e.g. the entire reduction relation may consist of associativity and commutativity rules. Consequently,some authors define the reduction relation as the indexed union of some relations; for instance if1 2= ,the notation used is (A, 1, 2).As a mathematical object, an ARS is exactly the same as an unlabeled state transition system, and if the relation isconsidered as an indexed union, then an ARS is the same as a labeled state transition system with the indices being thelabels. The focus of the study, and the terminology are different however. In a state transition system one is interestedin interpreting the labels as actions, whereas in an ARS the focus is on how objects may be transformed (rewritten)into others.[6]

    3.2 Example 1

    Suppose the set of objects is T = {a, b, c} and the binary relation is given by the rules a b, b a, a c, and b c. Observe that these rules can be applied to both a and b to get c. Note also, that c is, in a sense, a simplest objectin the system, since nothing can be applied to c to transform it any further. Such a property is clearly an importantone.

    5

    https://en.wikipedia.org/wiki/Mathematical_logichttps://en.wikipedia.org/wiki/Theoretical_computer_sciencehttps://en.wikipedia.org/wiki/Formalism_(mathematics)https://en.wikipedia.org/wiki/Rewritinghttps://en.wikipedia.org/wiki/Set_(mathematics)https://en.wikipedia.org/wiki/Binary_relationhttps://en.wikipedia.org/wiki/Binary_relationhttps://en.wikipedia.org/wiki/Normal_form_(abstract_rewriting)https://en.wikipedia.org/wiki/Normal_form_(abstract_rewriting)https://en.wikipedia.org/wiki/Termination_(term_rewriting)https://en.wikipedia.org/wiki/Confluence_(abstract_rewriting)https://en.wikipedia.org/wiki/G%C3%A9rard_Huethttps://en.wikipedia.org/wiki/G%C3%A9rard_Huethttps://en.wikipedia.org/wiki/Binary_relationhttps://en.wikipedia.org/wiki/Associativityhttps://en.wikipedia.org/wiki/Commutativityhttps://en.wikipedia.org/wiki/State_transition_systemhttps://en.wikipedia.org/wiki/State_transition_system
  • 6 CHAPTER 3. ABSTRACT REWRITING SYSTEM

    3.3 Basic notions

    Example 1 leads us to define some important notions in the general setting of an ARS. First we need some basicnotions and notations.[7]

    is the transitive closure of = , where = is the identity relation, i.e. is the smallest preorder (reflexiveand transitive relation) containing . It is also called the reflexive transitive closure of .

    is 1 , that is the union of the relation with its inverse relation, also known as the symmetricclosure of .

    is the transitive closure of = , that is is the smallest equivalence relation containing . It is alsoknown as the reflexive transitive symmetric closure of .

    3.4 Normal forms and the word problem

    Main article: Normal form (abstract rewriting)

    An object x in A is called reducible if there exist some other y in A and x y ; otherwise it is called irreducibleor a normal form. An object y is called a normal form of x if x y , and y is irreducible. If x has a unique normalform, then this is usually denoted with x . In example 1 above, c is a normal form, and c = a = b . If everyobject has at least one normal form, the ARS is called normalizing.One of the important problems that may be formulated in an ARS is the word problem: given x and y are theyequivalent under ? This is a very general setting for formulating the word problem for the presentation of analgebraic structure. For instance, the word problem for groups is a particular case of an ARS word problem. Centralto an easy solution for the word problem is the existence of unique normal forms: in this case if two objects havethe same normal form, then they are equivalent under . The word problem for an ARS is undecidable in general.

    3.5 Joinability and the ChurchRosser property

    A related, but weaker notion than the existence of normal forms is that of two objects being joinable: x and y aresaid joinable if there exists some z with the property that x z y . From this definition, its apparent one may definethe joinability relation as , where is the composition of relations. Joinability is usually denoted, somewhatconfusingly, also with , but in this notation the down arrow is a binary relation, i.e. we write xy if x and y arejoinable.An ARS is said to possess the Church-Rosser property if and only if x y implies xy for all objects x, y. Equiva-lently, the Church-Rosser property means that the reflexive transitive symmetric closure is contained in the joinabilityrelation. Alonzo Church and J. Barkley Rosser proved in 1936 that lambda calculus has this property;[8] hence thename of the property.[9] (The fact that lambda calculus has this property is also known as the Church-Rosser theo-rem.) In an ARS with the Church-Rosser property the word problem may be reduced to the search for a commonsuccessor. In a Church-Rosser system, an object has at most one normal form; that is the normal form of an object isunique if it exists, but it may well not exist. In lambda calculus for instance, the expression (x.xx)(x.xx) does nothave a normal form because there exists an infinite sequence of beta reductions (x.xx)(x.xx) (x.xx)(x.xx) ...[10]

    3.6 Notions of confluence

    See also: Confluence (abstract rewriting)

    Various properties, simpler than Church-Rosser, are equivalent to it. The existence of these equivalent propertiesallows one to prove that a system is Church-Rosser with less work. Furthermore, the notions of confluence can be

    https://en.wikipedia.org/wiki/Transitive_closurehttps://en.wikipedia.org/wiki/Identity_relationhttps://en.wikipedia.org/wiki/Preorderhttps://en.wikipedia.org/wiki/Reflexive_relationhttps://en.wikipedia.org/wiki/Transitive_relationhttps://en.wikipedia.org/wiki/Reflexive_transitive_closurehttps://en.wikipedia.org/wiki/Inverse_relationhttps://en.wikipedia.org/wiki/Symmetric_closurehttps://en.wikipedia.org/wiki/Symmetric_closurehttps://en.wikipedia.org/wiki/Transitive_closurehttps://en.wikipedia.org/wiki/Equivalence_relationhttps://en.wikipedia.org/wiki/Reflexive_transitive_symmetric_closurehttps://en.wikipedia.org/wiki/Normal_form_(abstract_rewriting)https://en.wikipedia.org/wiki/Word_problem_(mathematics)https://en.wikipedia.org/wiki/Word_problem_(mathematics)https://en.wikipedia.org/wiki/Word_problem_for_groupshttps://en.wikipedia.org/wiki/Undecidable_problemhttps://en.wikipedia.org/wiki/Composition_of_relationshttps://en.wikipedia.org/wiki/Alonzo_Churchhttps://en.wikipedia.org/wiki/J._Barkley_Rosserhttps://en.wikipedia.org/wiki/Lambda_calculushttps://en.wikipedia.org/wiki/Church-Rosser_theoremhttps://en.wikipedia.org/wiki/Church-Rosser_theoremhttps://en.wikipedia.org/wiki/Beta_reductionhttps://en.wikipedia.org/wiki/Confluence_(abstract_rewriting)
  • 3.6. NOTIONS OF CONFLUENCE 7

    Solving the word problem: deciding if x y usually requires heuristic search (red, green), while deciding x = y is straight-forward (grey). For term rewriting systems the Knuth-Bendix completion algorithm enlarges to establish unique normal forms, ifpossible.

    defined as properties of a particular object, something thats not possible for Church-Rosser. An ARS (A,) is saidto be,

    confluent if and only if for all w, x, and y in A, x w y implies xy . Roughly speaking, confluence saysthat no matter how two paths diverge from a common ancestor (w), the paths are joining at some commonsuccessor. This notion may be refined as property of a particular object w, and the system called confluent ifall its elements are confluent.

    semi-confluent if and only if for all w, x, and y in A, x w y implies xy . This differs from confluenceby the single step reduction from w to x.

    locally confluent if and only if for all w, x, and y in A, x w y implies xy . This property is sometimescalled weak confluence.

    Theorem. For an ARS the following three conditions are equivalent: (i) it has the Church-Rosser property, (ii) it isconfluent, (iii) it is semi-confluent.[11]

    Corollary.[12] In a confluent ARS if x y then

    https://en.wikipedia.org/wiki/Knuth-Bendix_completion_algorithm
  • 8 CHAPTER 3. ABSTRACT REWRITING SYSTEM

    If both x and y are normal forms, then x = y.

    If y is a normal form, then x y

    Because of these equivalences, a fair bit of variation in definitions is encountered in the literature. For instance, inTerese the Church-Rosser property and confluence are defined to be synonymous and identical to the definition ofconfluence presented here; Church-Rosser as defined here remains unnamed, but is given as an equivalent property;this departure from other texts is deliberate.[13] Because of the above corollary, one may define a normal form y of xas an irreducible y with the property that x y . This definition, found in Book and Otto, is equivalent to commonone given here in a confluent system, but it is more inclusive in a non-confluent ARS.Local confluence on the other hand is not equivalent with the other notions of confluence given in this section, but itis strictly weaker than confluence. The typical counterexample is {a b, b a, a x, b y} , which is locallyconfluent but not confluent.

    3.7 Termination and convergence

    An abstract rewriting system is said to be terminating or noetherian if there is no infinite chain x0 x1 x2 . (This is just saying that the rewriting relation is a Noetherian relation.) In a terminating ARS, every objecthas at least one normal form, thus it is normalizing. The converse is not true. In example 1 for instance, there isan infinite rewriting chain, namely a b a b , even though the system is normalizing. A confluentand terminating ARS is called canonical,[14] or convergent. In a convergent ARS, every object has a unique normalform. But it is sufficient for the system to be confluent and normalizing for a unique normal to exist for every element,as seen in example 1.Theorem (Newmans Lemma): A terminating ARS is confluent if and only if it is locally confluent.The original 1942 proof of this result by Newman was rather complicated. It wasn't until 1980 that Huet publisheda much simpler proof exploiting the fact that when is terminating we can apply well-founded induction.[15]

    3.8 Notes[1] Book and Otto, p. 9

    [2] Terese, p. 7,

    [3] Book and Otto, p. 10

    [4] Terese, p. 7

    [5] Book and Otto, p. 10

    [6] Terese, p. 7-8

    [7] Baader and Nipkow, pp. 8-9

    [8] Alonzo Church and J. Barkley Rosser. Some properties of conversion. Trans. AMS, 39:472-482, 1936

    [9] Baader and Nipkow, p. 9

    [10] S.B. Cooper, Computability theory, p. 184

    [11] Baader and Nipkow, p. 11

    [12] Baader and Nipkow, p. 12

    [13] Terese p.11

    [14] David A. Duffy (1991). Principles of Automated Theorem Proving. Wiley. Here: sect.7.2.1, p.153

    [15] Harrison, p. 260

    https://en.wikipedia.org/wiki/Noetherian_relationhttps://en.wikipedia.org/wiki/Newman%2527s_Lemmahttps://en.wikipedia.org/wiki/Well-founded_induction
  • 3.9. FURTHER READING 9

    3.9 Further reading Baader, Franz; Nipkow, Tobias (1998). Term Rewriting and All That. Cambridge University Press. A textbook

    suitable for undergraduates.

    Nachum Dershowitz and Jean-Pierre Jouannaud Rewrite Systems, Chapter 6 in Jan van Leeuwen (Ed.), Hand-book of Theoretical Computer Science, Volume B: Formal Models and Sematics., Elsevier and MIT Press, 1990,ISBN 0-444-88074-7, pp. 243320. The preprint of this chapter is freely available from the authors, but itmisses the figures.

    Ronald V. Book and Friedrich Otto, String-rewriting Systems, Springer (1993). Chapter 1, Abstract reductionsystems

    Marc Bezem, Jan Willem Klop, Roel de Vrijer (Terese), Term rewriting systems, Cambridge University Press,2003, ISBN 0-521-39115-6, Chapter 1. This is a comprehensive monograph. It uses however a fair deal ofnotations and definitions not commonly encountered elsewhere. For instance the ChurchRosser property isdefined to be identical with confluence.

    John Harrison, Handbook of Practical Logic and Automated Reasoning, Cambridge University Press, 2009,ISBN 978-0-521-89957-4, chapter 4 Equality. Abstract rewriting from the practical perspective of solvingproblems in equational logic.

    Grard Huet, Confluent Reductions: Abstract Properties and Applications to Term Rewriting Systems, Journal ofthe ACM (JACM), October 1980, Volume 27, Issue 4, pp. 797821. Huets paper established many of themodern concepts, results and notations.

    Sinyor, J.; The 3x+1 Problem as a String Rewriting System, International Journal of Mathematics and Math-ematical Sciences, Volume 2010 (2010), Article ID 458563, 6 pages.

    3.10 External links Abstract Rewrite Tool Java Applet to analyse abstract rewrite systems.

    https://en.wikipedia.org/wiki/Franz_Baaderhttps://en.wikipedia.org/wiki/Tobias_Nipkowhttps://en.wikipedia.org/wiki/Nachum_Dershowitzhttps://en.wikipedia.org/wiki/Jean-Pierre_Jouannaudhttp://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.64.3114https://en.wikipedia.org/wiki/Jan_van_Leeuwenhttps://en.wikipedia.org/wiki/Special:BookSources/0444880747https://en.wikipedia.org/wiki/Preprinthttps://en.wikipedia.org/wiki/Ronald_V._Bookhttps://en.wikipedia.org/wiki/Friedrich_Ottohttps://en.wikipedia.org/wiki/Marc_Bezemhttps://en.wikipedia.org/wiki/Jan_Willem_Klophttps://en.wikipedia.org/wiki/Roel_de_Vrijerhttps://en.wikipedia.org/wiki/Special:BookSources/0521391156https://en.wikipedia.org/wiki/John_Harrisonhttps://en.wikipedia.org/wiki/Special:BookSources/9780521899574https://en.wikipedia.org/wiki/Propositional_calculus#Equivalence_to_equational_logicshttps://en.wikipedia.org/wiki/G%C3%A9rard_Huethttps://en.wikipedia.org/wiki/JACMhttp://downloads.hindawi.com/journals/ijmms/2010/458563.pdfhttp://www.pi23.net/art2/
  • Chapter 4

    Abstract semantic graph

    In computer science, an abstract semantic graph (ASG) or term graph is a form of abstract syntax in whichan expression of a formal or programming language is represented by a graph whose vertices are the expressionssubterms. An ASG is at a higher level of abstraction than an abstract syntax tree (or AST), which is used to expressthe syntactic structure of an expression or program.ASGs are more complex and concise than ASTs because they may contain shared subterms (also known as commonsubexpressions).[1] Abstract semantic graphs are often used as an intermediate representation by compilers to storethe results of performing common subexpression elimination upon abstract syntax trees. ASTs are trees and are thusincapable of representing shared terms. ASGs are usually directed acyclic graphs. However, they may be cyclic,particularly in the field of graph rewriting. Cyclic graphs may represent recursive expressions which are commonlyused to express iteration in functional programming languages without looping constructs.The nomenclature term graph is associated with the field of term graph rewriting,[2] which involves the transformationand processing of expressions by the specification of rewriting rules,[3] whereas abstract semantic graph is used whendiscussing linguistics, programming languages, type systems and compilation.Abstract syntax trees are not capable of representing shared subexpressions due to their simplistic structure; thissimplicity comes at a cost of efficiency due to redundant duplicate computations of identical terms. For this reasonASGs are often used as an intermediate language at a subsequent compilation stage to abstract syntax tree constructionvia parsing.An abstract semantic graph is typically constructed from an abstract syntax tree by a process of enrichment andabstraction. The enrichment can for example be the addition of back-pointers, edges from an identifier node (wherea variable is being used) to a node representing the declaration of that variable. The abstraction can entail the removalof details which are relevant only in parsing, not for semantics.

    4.1 See also

    Ontology (computer science)

    Semantic Web

    Semantic Grid

    4.2 References

    [1] Garner, Richard (2011). An abstract view on syntax with sharing. Oxford University press. doi:10.1093/logcom/exr021.The notion of term graph encodes a refinement of inductively generated syntax in which regard is paid to the sharing anddiscard of subterms.

    [2] Plump, D. (1999). Ehrig, Hartmut; Engels, G.; Rozenberg, Grzegorz, eds. Handbook of Graph Grammars and Computingby Graph Transformation: applications, languages and tools 2. World Scientific. pp. 913. ISBN 9789810228842.

    10

    https://en.wikipedia.org/wiki/Computer_sciencehttps://en.wikipedia.org/wiki/Graph_(data_structure)https://en.wikipedia.org/wiki/Abstract_syntaxhttps://en.wikipedia.org/wiki/Expression_(computer_science)https://en.wikipedia.org/wiki/Formal_languagehttps://en.wikipedia.org/wiki/Programming_languagehttps://en.wikipedia.org/wiki/Graph_(mathematics)https://en.wikipedia.org/wiki/Term_(mathematics)https://en.wikipedia.org/wiki/Abstraction_(computer_science)https://en.wikipedia.org/wiki/Abstract_syntax_treehttps://en.wikipedia.org/wiki/Syntaxhttps://en.wikipedia.org/wiki/Program_(computer_science)https://en.wikipedia.org/wiki/Intermediate_representationhttps://en.wikipedia.org/wiki/Compilershttps://en.wikipedia.org/wiki/Common_subexpression_eliminationhttps://en.wikipedia.org/wiki/Abstract_syntax_treeshttps://en.wikipedia.org/wiki/Tree_(computer_science)https://en.wikipedia.org/wiki/Directed_acyclic_graphhttps://en.wikipedia.org/wiki/Cyclic_graphhttps://en.wikipedia.org/wiki/Graph_rewritinghttps://en.wikipedia.org/wiki/Recursivehttps://en.wikipedia.org/wiki/Iterationhttps://en.wikipedia.org/wiki/Functional_programming_languagehttps://en.wikipedia.org/wiki/Loop_(computing)https://en.wikipedia.org/wiki/Graph_rewriting#Term_graph_rewritinghttps://en.wikipedia.org/wiki/Linguisticshttps://en.wikipedia.org/wiki/Programming_languageshttps://en.wikipedia.org/wiki/Type_systemshttps://en.wikipedia.org/wiki/Compilerhttps://en.wikipedia.org/wiki/Intermediate_languagehttps://en.wikipedia.org/wiki/Pointer_(computer_programming)https://en.wikipedia.org/wiki/Edge_(graph_theory)https://en.wikipedia.org/wiki/Identifierhttps://en.wikipedia.org/wiki/Variable_(programming)https://en.wikipedia.org/wiki/Declaration_(computer_science)https://en.wikipedia.org/wiki/Logical_consequencehttps://en.wikipedia.org/wiki/Parsinghttps://en.wikipedia.org/wiki/Ontology_(computer_science)https://en.wikipedia.org/wiki/Semantic_Webhttps://en.wikipedia.org/wiki/Semantic_Gridhttps://en.wikipedia.org/wiki/Oxford_Universityhttps://en.wikipedia.org/wiki/Digital_object_identifierhttps://dx.doi.org/10.1093%252Flogcom%252Fexr021https://en.wikipedia.org/wiki/International_Standard_Book_Numberhttps://en.wikipedia.org/wiki/Special:BookSources/9789810228842
  • 4.3. EXTERNAL LINKS 11

    [3] Barendregt, H. P.; van Eekelen, M. C. J. D.; Glauert, J. R. W.; Kennaway, J. R.; Plasmeijer, M. J.; Sleep, M. R. (1987).Term graph rewriting. PARLE Parallel Architectures and Languages Europe (Lecture Notes in Computer Science) 259:141158. doi:10.1007/3-540-17945-3_8.

    4.3 External links Dean, Tom. CPPX - C/C++ Fact Extractor.

    Devanbu, Premkumar T.; Rosenblum, David S.; Wolf, Alexander L.. Generating Testing and Analysis Toolswith Aria.

    Mamas, Evan; Kontogiannis, Kostas. Towards Portable Source Code Representations Using XML. CiteSeerX:10 .1 .1 .88 .6173.

    Raghavan, Shruti; Rohana, Rosanne; Leon, David; Podgurski, Andy; Augustine, Vinay (2004). Dex: asemantic-graph differencing tool for studying changes in large code bases. IEEE International Conference onSoftware Maintenance. pp. 188197. doi:10.1109/icsm.2004.1357803.

    https://en.wikipedia.org/wiki/Digital_object_identifierhttps://dx.doi.org/10.1007%252F3-540-17945-3_8https://en.wikipedia.org/wiki/Tom_Dean_(computer_scientist)http://www.swag.uwaterloo.ca/cppx/old_cppx_site/https://en.wikipedia.org/wiki/Premkumar_T._Devanbuhttps://en.wikipedia.org/wiki/David_S._Rosenblumhttps://en.wikipedia.org/wiki/Alexander_L._Wolfhttp://citeseer.ist.psu.edu/devanbu96generating.htmlhttp://citeseer.ist.psu.edu/devanbu96generating.htmlhttps://en.wikipedia.org/wiki/Evan_Mamashttps://en.wikipedia.org/wiki/Kostas_Kontogiannishttps://en.wikipedia.org/wiki/CiteSeer#CiteSeerXhttp://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.88.6173http://www.citeulike.org/user/hayashi/article/259537http://www.citeulike.org/user/hayashi/article/259537https://en.wikipedia.org/wiki/Digital_object_identifierhttps://dx.doi.org/10.1109%252Ficsm.2004.1357803
  • Chapter 5

    Abstract syntax tree

    For the trees used in linguistics, see Concrete syntax tree.In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract

    syntactic structure of source code written in a programming language. Each node of the tree denotes a constructoccurring in the source code. The syntax is abstract in not representing every detail appearing in the real syntax.For instance, grouping parentheses are implicit in the tree structure, and a syntactic construct like an if-condition-thenexpression may be denoted by means of a single node with three branches.This distinguishes abstract syntax trees from concrete syntax trees, traditionally designated parse trees, which areoften built by a parser during the source code translation and compiling process. Once built, additional informationis added to the AST by means of subsequent processing, e.g., contextual analysis.Abstract syntax trees are also used in program analysis and program transformation systems.

    5.1 Application in compilers

    Abstract syntax trees are data structures widely used in compilers, due to their property of representing the structureof program code. An AST is usually the result of the syntax analysis phase of a compiler. It often serves as anintermediate representation of the program through several stages that the compiler requires, and has a strong impacton the final output of the compiler.

    5.1.1 Motivation

    Being the product of the syntax analysis phase of a compiler, the AST has several properties that are invaluable tothe further steps of the compilation process.

    Compared to the source code, an AST does not include certain elements, such as inessential punctuation anddelimiters (braces, semicolons, parentheses, etc.).

    A more important difference is that the AST can be edited and enhanced with properties and annotations forevery element it contains. Such editing and annotation is impossible with the source code of a program, sinceit would imply changing it.

    At the same time, an AST usually contains extra information about the program, due to the consecutive stagesof analysis by the compiler, an example being the position of an element in the source code. This informationmay be used to notify the user of the location of an error in the code.

    ASTs are needed because of the inherent nature of programming languages and their documentation. Languages areoften ambiguous by nature. In order to avoid this ambiguity, programming languages are often specified as a contextfree grammar (CFG). However, there are often aspects of programming languages that a CFG can't express, but arepart of the language and are documented in its specification. These are details that require a context to determinetheir validity and behaviour. For example, if a language allows new types to be declared, a CFG cannot predict the

    12

    https://en.wikipedia.org/wiki/Concrete_syntax_treehttps://en.wikipedia.org/wiki/Computer_sciencehttps://en.wikipedia.org/wiki/Directed_treehttps://en.wikipedia.org/wiki/Abstract_syntaxhttps://en.wikipedia.org/wiki/Abstract_syntaxhttps://en.wikipedia.org/wiki/Source_codehttps://en.wikipedia.org/wiki/Programming_languagehttps://en.wikipedia.org/wiki/Bracket#Parentheseshttps://en.wikipedia.org/wiki/Concrete_syntax_treehttps://en.wikipedia.org/wiki/Parse_treehttps://en.wikipedia.org/wiki/Parserhttps://en.wikipedia.org/wiki/Compilerhttps://en.wikipedia.org/wiki/Semantic_analysis_(compilers)https://en.wikipedia.org/wiki/Program_transformationhttps://en.wikipedia.org/wiki/Data_structureshttps://en.wikipedia.org/wiki/Compilershttps://en.wikipedia.org/wiki/Syntax_analysishttps://en.wikipedia.org/wiki/Syntax_analysishttps://en.wikipedia.org/wiki/Source_codehttps://en.wikipedia.org/wiki/Context_free_grammarhttps://en.wikipedia.org/wiki/Context_free_grammar
  • 5.1. APPLICATION IN COMPILERS 13

    condition

    body

    else-bodyif-body

    while

    variablename: b

    constantvalue: 0

    compareop:

    branch

    compareop: >

    assign

    bin opop:

    assign

    bin opop:

    statementsequence

    return

    variablename: a

    variablename: a

    variablename: a

    variablename: a

    variablename: a

    variablename: b

    variablename: b

    variablename: b

    variablename: b

    condition

    An abstract syntax tree for the following code for the Euclidean algorithm:

    while b 0

    if a > b

    a := a b

    else

    b := b a

    return a

    names of such types nor the way in which they should be used. Even if a language has a predefined set of types,enforcing proper usage usually requires some context. Another example is duck typing, where the type of an elementcan change depending on context. Operator overloading is yet another case where correct usage and final functionare determined based on the context. Java provides an excellent example, where the '+' operator is both numericaladdition and concatenation of strings.

    https://en.wikipedia.org/wiki/Euclidean_algorithmhttps://en.wikipedia.org/wiki/Duck_typinghttps://en.wikipedia.org/wiki/Operator_overloading
  • 14 CHAPTER 5. ABSTRACT SYNTAX TREE

    Although there are other data structures involved in the inner workings of a compiler, the AST performs a uniquefunction. During the first stage, the syntax analysis stage, a compiler produces a parse tree. This parse tree can beused to perform almost all functions of a compiler by means of syntax-directed translation. Although this methodcan lead to a more efficient compiler, it goes against the software engineering principles of writing and maintainingprograms. Another advantage that the AST has over a parse tree is the size, particularly the smaller height of the ASTand the smaller number of elements.

    5.1.2 Design

    The design of an AST is often closely linked with the design of a compiler and its expected features.Core requirements include the following:

    Variable types must be preserved, as well as the location of each declaration in source code.

    The order of executable statements must be explicitly represented and well defined.

    Left and right components of binary operations must be stored and correctly identified.

    Identifiers and their assigned values must be stored for assignment statements.

    These requirements can be used to design the data structure for the AST.Some operations will always require two elements, such as the two terms for addition. However, some language con-structs require an arbitrarily large number of children, such as argument lists passed to programs from the commandshell. As a result, an AST has to also be flexible enough to allow for quick addition of an unknown quantity ofchildren.Another major design requirement for an AST is that it should be possible to unparse an AST into source code form.The source code produced should be sufficiently similar to the original in appearance and identical in execution, uponrecompilation.

    5.1.3 Design patterns

    Due to the complexity of the requirements for an AST and the overall complexity of a compiler, it is beneficial toapply sound software development principles. One of these is to use proven design patterns to enhance modularityand ease of development.Different operations don't necessarily have different types, so it is important to have a sound node class hierarchy.This is crucial in the creation and the modification of the AST as the compiler progresses.Because the compiler traverses the tree several times to determine syntactic correctness, it is important to maketraversing the tree a simple operation. The compiler executes a specific set of operations, depending on the type ofeach node, upon reaching it, so it often makes sense to use the Visitor pattern.

    5.1.4 Usage

    The AST is used intensively during semantic analysis, where the compiler checks for correct usage of the elements ofthe program and the language. The compiler also generates symbol tables based on the AST during semantic analysis.A complete traversal of the tree allows verification of the correctness of the program.After verifying correctness, the AST serves as the base for code generation. The AST is often used to generate the'intermediate representation' '(IR)', sometimes called an intermediate language, for the code generation.

    5.2 See also Abstract semantic graph (ASG)

    Composite pattern

    https://en.wikipedia.org/wiki/Data_structurehttps://en.wikipedia.org/wiki/Syntax_analysishttps://en.wikipedia.org/wiki/Command_shellhttps://en.wikipedia.org/wiki/Command_shellhttps://en.wikipedia.org/wiki/Visitor_patternhttps://en.wikipedia.org/wiki/Semantic_analysis_(compilers)https://en.wikipedia.org/wiki/Intermediate_languagehttps://en.wikipedia.org/wiki/Abstract_semantic_graphhttps://en.wikipedia.org/wiki/Composite_pattern
  • 5.3. REFERENCES 15

    Document Object Model (DOM)

    Extended BackusNaur Form

    Lisp, a family of languages written in trees, with macros to manipulate code trees at compile time

    Semantic resolution tree (RST)

    Shunting yard algorithm

    Symbol table

    TreeDL

    Term graph

    5.3 References This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November

    2008 and incorporated under the relicensing terms of the GFDL, version 1.3 or later.

    5.4 Further reading Jones, Joel. Abstract Syntax Tree Implementation Idioms (PDF). (overview of AST implementation in var-

    ious language families)

    Neamtiu, Iulian; Foster, Jeffrey S.; Hicks, Michael (May 17, 2005). Understanding Source Code EvolutionUsing Abstract Syntax Tree Matching. MSR'05. Saint Louis, Missouri: ACM. CiteSeerX: 10 .1 .1 .88 .5815.

    Baxter, Ira D.; Yahin, Andrew; Moura, Leonardo; Sant' Anna, Marcelo; Bier, Lorraine (November 1619,1998). Clone Detection Using Abstract Syntax Trees (PDF). Proceedings of ICSM'98 (Bethesda, Maryland:IEEE).

    Fluri, Beat; Wrsch, Michael; Pinzger, Martin; Gall, Harald C. Change Distilling: Tree Differencing forFine-Grained Source Code Change Extraction (PDF).

    Wrsch, Michael. Improving Abstract Syntax Tree based Source Code Change Detection (Diploma thesis).

    Lucas, Jason. Thoughts on the Visual C++ Abstract Syntax Tree (AST)".

    5.5 External links AST View: an Eclipse plugin to visualize a Java abstract syntax tree

    Good information about the Eclipse AST and Java Code Manipulation. eclipse.org.

    PMD on SourceForge.net: uses AST representation to control code source quality

    CAST representation. cs.utah.edu.

    eli project: Abstract Syntax Tree Unparsing

    Abstract Syntax Tree Metamodel Standard (PDF).

    ArchitectureDriven Modernization ADM: Abstract Syntax Tree Metmodel ASTM. (OMG standard).

    https://en.wikipedia.org/wiki/Document_Object_Modelhttps://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Formhttps://en.wikipedia.org/wiki/Lisp_(programming_language)https://en.wikipedia.org/wiki/Semantic_resolution_treehttps://en.wikipedia.org/wiki/Shunting_yard_algorithmhttps://en.wikipedia.org/wiki/Symbol_tablehttps://en.wikipedia.org/wiki/TreeDLhttps://en.wikipedia.org/wiki/Term_graphhttps://en.wikipedia.org/wiki/Free_On-line_Dictionary_of_Computinghttps://en.wikipedia.org/wiki/GNU_Free_Documentation_Licensehttp://www.hillside.net/plop/plop2003/Papers/Jones-ImplementingASTs.pdfhttps://en.wikipedia.org/wiki/CiteSeer#CiteSeerXhttp://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.88.5815http://www.semanticdesigns.com/Company/Publications/ICSM98.pdfhttps://en.wikipedia.org/wiki/IEEEhttp://seal.ifi.uzh.ch/fileadmin/User_Filemount/Publications/fluri-changedistilling.pdfhttp://seal.ifi.uzh.ch/fileadmin/User_Filemount/Publications/fluri-changedistilling.pdfhttp://www.ifi.uzh.ch/seal/research/tools/archive/changeDetection.htmlhttp://blogs.msdn.com/vcblog/archive/2006/08/16/702823.aspxhttp://www.eclipse.org/jdt/ui/astview/index.phphttps://en.wikipedia.org/wiki/Eclipse_(software)https://en.wikipedia.org/wiki/Scientific_visualizationhttps://en.wikipedia.org/wiki/Java_(programming_language)http://www.eclipse.org/articles/Article-JavaCodeManipulation_AST/index.htmlhttp://sourceforge.net/projects/pmd/https://en.wikipedia.org/wiki/SourceForgehttp://www.cs.utah.edu/flux/flick/current/doc/guts/gutsch6.htmlhttp://eli-project.sourceforge.net/elionline/idem_3.htmlhttps://en.wikipedia.org/wiki/Unparsinghttp://www.omg.org/news/meetings/workshops/ADM_2005_Proceedings_FINAL/T-3_Newcomb.pdfhttp://www.omg.org/spec/ASTM/https://en.wikipedia.org/wiki/Object_Management_Group
  • Chapter 6

    Action algebra

    In algebraic logic, an action algebra is an algebraic structure which is both a residuated semilattice and a Kleenealgebra. It adds the star or reflexive transitive closure operation of the latter to the former, while adding the left andright residuation or implication operations of the former to the latter. Unlike dynamic logic and other modal logics ofprograms, for which programs and propositions form two distinct sorts, action algebra combines the two into a singlesort. It can be thought of as a variant of intuitionistic logic with star and with a noncommutative conjunction whoseidentity need not be the top element. Unlike Kleene algebras, action algebras form a variety, which furthermore isfinitely axiomatizable, the crucial axiom being a(a a)* a. Unlike models of the equational theory of Kleenealgebras (the regular expression equations), the star operation of action algebras is reflexive transitive closure in everymodel of the equations.

    6.1 Definition

    An action algebra (A, , 0, , 1, , , *) is an algebraic structure such that (A, , , 1, , ) forms a residuatedsemilattice while (A, , 0, , 1, *) forms a Kleene algebra.[1] That is, it is any model of the joint theory of both classesof algebras. Now Kleene algebras are axiomatized with quasiequations, that is, implications between two or moreequations, whence so are action algebras when axiomatized directly in this way. However, action algebras have theadvantage that they also have an equivalent axiomatization that is purely equational.[2] The language of action algebrasextends in a natural way to that of action lattices, namely by the inclusion of a meet operation.[3]

    In the following we write the inequality a b as an abbreviation for the equation a b = b. This allows us to axiomatizethe theory using inequalities yet still have a purely equational axiomatization when the inequalities are expanded toequalities.The equations axiomatizing action algebra are those for a residuated semilattice, together with the following equationsfor star.

    1 a*a* a a*a* (ab)*(a a)* a a

    The first equation can be broken out into three equations, 1 a*, a*a* a*, and a a*. These force a* to bereflexive, transitive, and greater or equal to a respectively. The second axiom asserts that star is monotone. The thirdaxiom can be written equivalently as a(aa)* a, a form which makes its role as induction more apparent. Thesetwo axioms in conjunction with the axioms for a residuated semilattice force a* to be the least reflexive transitiveelement of the semilattice greater or equal to a. Taking that as the definition of reflexive transitive closure of a, wethen have that for every element a of any action algebra, a* is the reflexive transitive closure of a.The equational theory of the implication-free fragment of action algebras, those equations not containing or , canbe shown to coincide with the equational theory of Kleene algebras, also known as the regular expression equations.In that sense the above axioms constitute a finite axiomatization of regular expressions. Redko showed in 1967 thatthese equations had no finite axiomatization, for which John Horton Conway gave a shorter proof in 1971. Salomaagave an equation schema axiomatizing this theory which Kozen subsequently reformulated as a finite axiomatization

    16

    https://en.wikipedia.org/wiki/Algebraic_logichttps://en.wikipedia.org/wiki/Algebraic_structurehttps://en.wikipedia.org/wiki/Residuated_semilatticehttps://en.wikipedia.org/wiki/Kleene_algebrahttps://en.wikipedia.org/wiki/Kleene_algebrahttps://en.wikipedia.org/wiki/Dynamic_logic_(modal_logic)https://en.wikipedia.org/wiki/Heyting_algebrahttps://en.wikipedia.org/wiki/Algebraic_varietyhttps://en.wikipedia.org/wiki/Algebraic_structurehttps://en.wikipedia.org/wiki/Residuated_semilatticehttps://en.wikipedia.org/wiki/Residuated_semilatticehttps://en.wikipedia.org/wiki/Kleene_algebrahttps://en.wikipedia.org/wiki/Regular_expressionhttps://en.wikipedia.org/wiki/John_Horton_Conway
  • 6.2. EXAMPLES 17

    using quasiequations or implications between equations, the crucial quasiequations being those of induction: if xa x then xa* x, and if ax x then a*x x. Kozen defined a Kleene algebra to be any model of this finiteaxiomatization.Conway showed that the equational theory of regular expressions admit models in which a* was not the reflexivetransitive closure of a, by giving a four-element model 0 1 a a* in which aa = a. In Conways model, a isreflexive and transitive, whence its reflexive transitive closure should be a. However the regular expressions do notenforce this, allowing a* to be strictly greater than a. Such anomalous behavior is not possible in an action algebra.

    6.2 Examples

    Any Heyting algebra (and hence any Boolean algebra) is made an action algebra by taking to be and a* = 1. Thisis necessary and sufficient for star because the top element 1 of a Heyting algebra is its only reflexive element, and istransitive as well as greater or equal to every element of the algebra.The set 2* of all formal languages (sets of finite strings) over an alphabet forms an action algebra with 0 as theempty set, 1 = {}, as union, as concatenation, LM as the set of all strings x such that xM L (and dually forML), and L* as the set of all strings of strings in L (Kleene closure).The set 2X of all binary relations on a set X forms an action algebra with 0 as the empty relation, 1 as the identityrelation or equality, as union, as relation composition, RS as the relation consisting of all pairs (x,y) such thatfor all z in X, ySz implies xRz (and dually for SR), and R* as the reflexive transitive closure of R, defined as theunion over all relations Rn for integers n 0.The two preceding examples are power sets, which are Boolean algebras under the usual set theoretic operations ofunion, intersection, and complement. This justifies calling them Boolean action algebras. The relational exampleconstitutes a relation algebra equipped with an operation of reflexive transitive closure. Note that every Booleanalgebra is a Heyting algebra and therefore an action algebra by virtue of being an instance of the first example.

    6.3 See also Kleene star

    Regular expression

    6.4 References[1] Kozen, Dexter (1990), On Kleene algebras and closed semirings, in B. Rovan, Mathematical Foundations of Computer

    Science (MFCS), LNCS 452, Springer-Verlag, pp. 2647

    [2] Pratt, Vaughan (1990), Action Logic and Pure Induction, Logics in AI: European Workshop JELIA '90 (ed. J. van Eijck),LNCS 478, Springer-Verlag, pp. 97120.

    [3] Kozen, Dexter (1994), On action algebras, Logic and information flow, Found. Comput. Ser., MIT Press, Cambridge,MA, pp. 7888, MR 1295061.

    Conway, J.H. (1971). Regular algebra and finite machines. London: Chapman and Hall. ISBN 0-412-10620-5.Zbl 0231.94041.

    V.N. Redko, On defining relations for the algebra of regular events (Russian), Ukrain. Mat. Z., 16:120126,1964.

    https://en.wikipedia.org/wiki/Heyting_algebrahttps://en.wikipedia.org/wiki/Boolean_algebra_(structure)https://en.wikipedia.org/wiki/Formal_languagehttps://en.wikipedia.org/wiki/Boolean_algebra_(logic)https://en.wikipedia.org/wiki/Relation_algebrahttps://en.wikipedia.org/wiki/Kleene_starhttps://en.wikipedia.org/wiki/Regular_expressionhttp://boole.stanford.edu/pub/jelia.pdfhttp://boole.stanford.edu/pub/jelia.pdfhttp://www.cs.cornell.edu/~kozen/papers/act.pdfhttps://en.wikipedia.org/wiki/Mathematical_Reviewshttps://www.ams.org/mathscinet-getitem?mr=1295061https://en.wikipedia.org/wiki/John_Horton_Conwayhttps://en.wikipedia.org/wiki/International_Standard_Book_Numberhttps://en.wikipedia.org/wiki/Special:BookSources/0-412-10620-5https://en.wikipedia.org/wiki/Zentralblatt_MATHhttps://zbmath.org/?format=complete&q=an:0231.94041
  • Chapter 7

    Adaptive grammar

    An adaptive grammar is a formal grammar that explicitly provides mechanisms within the formalism to allow itsown production rules to be manipulated.

    7.1 Overview

    John N. Shutt defines adaptive grammars as follows:

    ADAPTIVE GRAMMAR MODEL: A grammatical formalism that allows rule sets (aka sets of produc-tion rules) to be explicitly manipulated within a grammar.[1]

    Types of manipulation include rule addition, deletion, and modification.

    7.1.1 Early history

    The first description of grammar adaptivity (though not under that name) in the literature is generally[2][3][4] takento be in a paper by Alfonso Caracciolo di Forino published in 1963.[5] The next generally accepted reference toan adaptive formalism (extensible context-free grammars) came from Wegbreit in 1970[6] in the study of extensibleprogramming languages, followed by the dynamic syntax of Hanford and Jones in 1973.[7]

    7.1.2 Collaborative efforts

    Until fairly recently, much of the research into the formal properties of adaptive grammars was uncoordinated be-tween researchers, only first being summarized by Henning Christiansen in 1990[2] in response to a paper in ACMSIGPLAN Notices by Boris Burshteyn.[8] The Department of Engineering at the University of So Paulo has itsAdaptive Languages and Techniques Laboratory, specifically focusing on research and practice in adaptive tech-nologies and theory. The LTA also maintains a page naming researchers in the field.[9]

    7.1.3 Terminology and taxonomy

    While early efforts made reference to dynamic syntax[7] and extensible,[6] modifiable,[10] dynamic,[11] and adapt-able[2][12] grammars, more recent usage has tended towards the use of the term adaptive (or some variant such asadaptativa,[13][14] depending on the publication language of the literature).[3] Iwai refers to her formalism as adap-tive grammars,[13] but this specific use of simply adaptive grammars is not typically currently used in the literaturewithout name qualification. Moreover, no standardization or categorization efforts have been undertaken betweenvarious researchers, although several have made efforts in this direction.[3][4]

    18

    https://en.wikipedia.org/wiki/Formal_grammarhttps://en.wikipedia.org/wiki/Formal_systemhttps://en.wikipedia.org/wiki/John_N._Shutthttps://en.wikipedia.org/wiki/Extensible_programming_languagehttps://en.wikipedia.org/wiki/Extensible_programming_languagehttps://en.wikipedia.org/wiki/Formal_systemhttps://en.wikipedia.org/wiki/SIGPLANhttps://en.wikipedia.org/wiki/University_of_S%C3%A3o_Paulohttp://lta.poli.usp.br/
  • 7.2. ADAPTIVE FORMALISMS IN THE LITERATURE 19

    The Shutt classification (and extensions)

    Shutt categorizes adaptive grammar models into two main categories:[3][15]

    Imperative adaptive grammars vary their rules based on a global state changing over the time of the generationof a language.

    Declarative adaptive grammars vary their rules only over the space of the generation of a language (i.e., positionin the syntax tree of the generated string).

    Jackson refines Shutts taxonomy, referring to changes over time as global and changes over space as local, and addinga hybrid time-space category:[4]

    Time-space adaptive grammars (hybrids) vary their rules over either the time or the space (or both) of thegeneration of a language (and local and global operations are explicitly differentiated by the notation for suchchanges).

    7.2 Adaptive formalisms in the literature

    Adaptive formalisms may be divided into two main categories: full grammar formalisms (adaptive grammars), andadaptive machines, upon which some grammar formalisms have been based.

    7.2.1 Adaptive grammar formalisms

    The following is a list (by no means complete) of grammar formalisms that, by Shutts definition above, are consideredto be (or have been classified by their own inventors as being) adaptive grammars. They are listed in their historicalorder of first mention in the literature.

    Extensible Context-Free Grammars (Wegbreit)

    Described in Wegbreits doctoral dissertation in 1970,[6] an extensible context-free grammar consists of a context-free grammar whose rule set is modified according to instructions output by a finite state transducer when readingthe terminal prefix during a leftmost derivation. Thus, the rule set varies over position in the generated string, butthis variation ignores the hierarchical structure of the syntax tree. Extensible context-free grammars were classifiedby Shutt as imperative.[3]

    Christiansen Grammars (Christiansen)

    First introduced in 1985 as Generative Grammars[16] and later more elaborated upon,[17] Christiansen grammars(apparently dubbed so by Shutt, possibly due to conflict with Chomsky generative grammars) are an adaptive extensionof attribute grammars. Christiansen grammars were classified by Shutt as declarative.[3]

    The redoubling language L = {ww|w is a letter} is demonstrated as follows:[17]

    where w-rule = w a

    Bottom-Up Modifiable Grammars, Top-Down Modifiable Grammars, and USSA (Burshteyn)

    First introduced in May 1990[8] and later expanded upon in December 1990,[10] modifiable grammars explicitlyprovide a mechanism for the addition and deletion of rules during a parse. In response to the ACM SIGPLAN No-tices responses, Burshteyn later modified his formalism and introduced his adaptive Universal Syntax and SemanticsAnalyzer (USSA) in 1992.[18] These formalisms were classified by Shutt as imperative.[3]

    https://en.wikipedia.org/wiki/Imperative_programminghttps://en.wikipedia.org/wiki/State_(computer_science)https://en.wikipedia.org/wiki/Generative_grammarhttps://en.wikipedia.org/wiki/Formal_languagehttps://en.wikipedia.org/wiki/Declarative_programminghttps://en.wikipedia.org/wiki/Global_variablehttps://en.wikipedia.org/wiki/Local_variablehttps://en.wikipedia.org/wiki/Context-free_grammarhttps://en.wikipedia.org/wiki/Context-free_grammarhttps://en.wikipedia.org/wiki/Finite_state_transducerhttps://en.wikipedia.org/wiki/Attribute_grammar
  • 20 CHAPTER 7. ADAPTIVE GRAMMAR

    Recursive Adaptive Grammars (Shutt)

    Introduced in 1993, Recursive Adaptive Grammars (RAGs) were an attempt to introduce a Turing powerful for-malism that maintained much of the elegance of context-free grammars.[3] Shutt self-classifies RAGs as being adeclarative formalism.

    Dynamic Grammars (Boullier)

    Boulliers dynamic grammars, introduced in 1994,[11] appear to be the first adaptive grammar family of grammarsto rigorously introduce the notion of a time continuum of a parse as part of the notation of the grammar formalismitself.[4] Dynamic grammars are a sequence of grammars, with each grammar Gi differing in some way from othergrammars in the sequence, over time. Boulliers main paper on dynamic grammars also defines a dynamic parser,the machine that effects a parse against these grammars, and shows examples of how his formalism can handle suchthings as type checking, extensible languages, polymorphism, and other constructs typically considered to be in thesemantic domain of programming language translation.

    Adaptive Grammars (Iwai)

    The work of Iwai in 2000[13] takes the adaptive automata of Neto[19] further by applying adaptive automata to context-sensitive grammars. Iwais adaptive grammars (note the qualifier by name) allow for three operations during a parse:? query (similar in some respects to a syntactic predicate, but tied to inspection of rules from which modificationsare chosen), + addition, and - deletion (which it shares with its predecessor adaptive automata).

    -Calculus (Jackson)

    Introduced in 2000[20] and most fully discussed in 2006,[4] the -Calculus ( here pronounced meta-ess) allows forthe explicit addition, deletion, and modification of productions within a grammar, as well as providing for syntacticpredicates. This formalism is self-classified by its creator as both imperative and adaptive, or, more specifically, as atime-space adaptive grammar formalism, and was further classified by others as being an analytic formalism.[14][21]

    The redoubling language L = {ww|w {a, b}+} is demonstrated as follows:grammar ww { S ::= #phi(A.X

  • 7.3. SEE ALSO 21

    7.2.2 Adaptive machine formalisms

    The formalisms listed below, while not grammar formalisms, either serve as the basis of full grammar formalisms,or are included here because they are adaptive in nature. They are listed in their historical order of first mention inthe literature.

    Self-Modifying Finite State Automata (Shutt & Rubinstein)

    Introduced in 1994 by Shutt and Rubinstein,[26] Self-Modifying Finite State Automata (SMFAs) areshown to be, in a restricted form, Turing powerful.

    Adaptive Automata (Neto)

    In 1994,[19] Neto introduced the machine he called a structured pushdown automaton, the core of adap-tive automata theory as pursued by Iwai,[13] Pistori,[23] Bravo[14] and others. This formalism allows forthe operations of inspection (similar to syntactic predicates, as noted above relating to Iwais adaptivegrammars), addition, and deletion of rules.

    7.3 See also

    Category:Extensible syntax programming languages

    7.4 References and notes[1] Shutt, John N., What is an Adaptive Grammar?" Web page dated 28 March 2001, at the URL: http://www.cs.wpi.edu/

    ~{}jshutt/adapt/adapt.html

    [2] Christiansen, Henning, A Survey of Adaptable Grammars, ACM SIGPLAN Notices, Vol. 25 No. 11, pp. 35-44, Nov.1990.

    [3] Shutt, John N., Recursive Adaptable Grammars, Masters Thesis, Worcester Polytechnic Institute, 1993. (16 December2003 emended revision.)

    [4] Jackson, Quinn Tyler, Adapting to Babel: Adaptivity and Context-Sensitivity in Parsing, Ibis Publications, Plymouth, Mas-sachusetts, March 2006.

    [5] Caracciolo di Forino, Alfonso, Some Remarks on the Syntax of Symbolic Programming Languages, Communications ofthe ACM, Vol. 6, No. 8., pp. 456-460, August 1963.

    [6] Wegbreit, Ben, Studies in Extensible Programming Languages, ESD-TR-70-297, Harvard University, Cambridge, Mas-sachusetts, May 1970. In book form, Garland Publishing, Inc., New York, 1980.

    [7] Hanford, K.V. & Jones, C.B., Dynamic Syntax: A Concept for the Definition of the Syntax of Programming Languages,Annual Review in Automatic Programming 7, Pergamon Press, Oxford, pp. 115-142, 1973.

    [8] Burshteyn, Boris. On the Modification of the Formal Grammar at Parse Time, ACM SIGPLAN Notices, Vol. 25 No. 5,pp. 117-123, May 1990.

    [9] http://www.pcs.usp.br/~{}lta/union/index.php?cp=4&categoria=28

    [10] Burshteyn, Boris, Generation and Recognition of Formal Languages by Modifiable Grammars, ACM SIGPLAN Notices,Vol. 25 No. 12, pp. 45-53, December 1990.

    [11] Boullier, Pierre, Dynamic Grammars and Semantic Analysis, INRIA Research Report No. 2322, August 1994.

    [12] John Shutt originally called his Recursive Adaptive Grammars by the name Recursive Adaptable Grammars, and notes hischange to adaptive at this URL: John Shutts MS Thesis.

    [13] Iwai, Margarete Keiko, Um formalismo gramatical adaptativo para linguagens dependentes de contexto, Doctoral thesis,Department of Engineering, University of So Paulo, Brazil, January 2000.

    https://en.wikipedia.org/wiki/Turing_completehttps://en.wikipedia.org/wiki/Syntactic_predicatehttps://en.wikipedia.org/wiki/Category:Extensible_syntax_programming_languageshttp://www.cs.wpi.edu/~jshutt/adapt/adapt.htmlhttp://www.cs.wpi.edu/~jshutt/adapt/adapt.htmlhttp://www.pcs.usp.br/~lta/union/index.php?cp=4&categoria=28http://web.cs.wpi.edu/~jshutt/thesis/top.html
  • 22 CHAPTER 7. ADAPTIVE GRAMMAR

    [14] Bravo, Csar, Grmmaticas Livres de Contexto Adaptativas com verificao de aparncia, Doctoral thesis, Department ofElectrical Engineering, University of So Paulo, January 2004.

    [15] Shutt, John N., Imperative Adaptive Grammars Web page dated 28 March 2001, at the URL: http://web.cs.wpi.edu/~{}jshutt/adapt/imperative.html

    [16] Christiansen, Henning, Syntax, Semantics, and Implementation Strategies for Programming Languages with PowerfulAbstraction Mechanisms, Proceedings of the 18th Hawaii International Conference on System Sciences, Vol. 2, pp. 57-66,1985.

    [17] Christiansen, Henning, The Syntax and Semantics of Extensible Languages, Datalogiske skrifter 14, Roskilde University,1988.

    [18] Burshteyn, Boris, USSAUniversal Syntax and Semantics Analyzer, ACM SIGPLAN Notices, Vol. 27 No. 1, pp. 42-60,January 1992.

    [19] Neto, Joo Jose, Adaptive Automata for Context-Sensitive Languages, ACM SIGPLAN Notices, Vol. 29 No. 9, pp.115-124, September 1994.

    [20] Jackson, Quinn Tyler, Adaptive Predicates in Natural Language Parsing, Perfection, Vol. 1 No. 4, April 2000.

    [21] Okhotin, Alexander, Boolean Grammars: Expressive Power and Algorithms, Doctoral thesis, School of Computing, QueensUniversity, Kingston, Ontario, August 2004.

    [22] Neto, Joo Jose, Adaptive Rule-Driven Devices: General Formulation and Case Study, B. W. Watson, D. Wood (Eds.):Implementation and Application of Automata 6th International Conference, CIAA 2001, Lecture Notes in Computer Science,Vol. 2494, Pretoria, South Africa, Springer-Verlag, pp. 234250, 2325 July 2001.

    [23] Pistori, Hemerson, Tecnologia Adaptativa em Engenharia de Computao: Estado da Arte e Aplicaes, Doctoral thesis,Department of Electrical Engineering, University of So Paulo, 2003.

    [24] Carmi, Adam, Adapser: An LALR(1) Adaptive Parser,The IsraeliWorkshop on Programming Languages&DevelopmentEnvironments, Haifa, Israel, 1 July 2002.

    [25] Salomaa, Arto, Formal Languages, Academic Press, 1973.

    [26] Shutt, John & Rubinstein, Roy, Self-Modifying Finite Automata, in B. Pehrson and I. Simon, editors, Technology andFoundations: Information Processing 94 Vol. I: Proceedings of 13th IFIP World Computer Congress, Amsterdam: North-Holland, pp. 493-498, 1994.

    7.5 External linksScholarly Conferences Specifically Covering Adaptive Aspects of Formal Languages

    ICANNGA 2005 - 7th International Conference on Adaptive & Natural Computing Algorithms (Coimbra,Portugal, 2325 March 2005)

    Adaptive Technology in AI (Presentations in various formalisms mentioned in this article.)

    Post-Secondary Level Courses Covering Adaptive Grammar

    Fundamentos e Aplicaes da Tecnologia Adaptativa (Escola Politcnica - University of So Paulo)

    List of Researchers in Adaptive Grammars

    http://www.pcs.usp.br/~{}lta/union/index.php?cp=4&categoria=28 (Maintained by LTA)

    http://web.cs.wpi.edu/~jshutt/adapt/imperative.htmlhttp://web.cs.wpi.edu/~jshutt/adapt/imperative.htmlhttps://en.wikipedia.org/wiki/Conference_on_Implementation_and_Application_of_Automatahttp://icannga05.dei.uc.pt/http://icannga05.dei.uc.pt/conference/overview/adapt_tech.htmlhttp://www.pcs.usp.br/~lta/disciplinas/fun_apl_tec_ada.htmhttps://en.wikipedia.org/wiki/University_of_S%C3%A3o_Paulohttp://www.pcs.usp.br/~lta/union/index.php?cp=4&categoria=28
  • Chapter 8

    Affix grammar

    An affix grammar is a kind of formal grammar; it is used to describe the syntax of languages, mainly computerlanguages, using an approach based on how natural language is typically described.The grammatical rules of an affix grammar are those of a context-free grammar, except that certain parts in thenonterminals (the affixes) are used as arguments. If the same affix occurs multiple times in a rule, its value mustagree, i.e. it must be the same everywhere. In some types of affix grammar, more complex relationships betweenaffix values are possible.

    8.1 Example

    We can describe an extremely simple fragment of English in the following manner:Sentence Subject Predicate Subject Noun Predicate Verb Object Object Noun Noun John Noun MaryNoun children Noun parents Verb like Verb likes Verb help Verb helpsThis context-free grammar describes simple sentences such asJohn likes children Mary helps John children help parents parents like JohnWith more nouns and verbs, and more rules to introduce other parts of speech, a large range of English sentencescan be described; so this is a promising approach for describing the syntax of English.However, the given grammar also describes sentences such asJohn like children children helps parentsThese sentences are wrong: in English, subject and verb have a grammatical number, which must agree.An affix grammar can express this directly:SentenceSubject+number Predicate+number Subject+numberNoun+number Predicate+numberVerb+numberObject ObjectNoun+number Noun+singular JohnNoun+singular MaryNoun+plural childrenNoun+plural parents Verb+singular likes Verb+plural like Verb+singular helps Verb+plural helpThis grammar only describes correct English sentences, although it could be argued thatJohn likes Johnis still incorrect and should instead readJohn likes himselfThis, too, can be incorporated using affixes, if the means of describing the relationships between different affix valuesare powerful enough. As remarked above, these means depend on the type of affix grammar chosen..

    23

    https://en.wikipedia.org/wiki/Formal_grammarhttps://en.wikipedia.org/wiki/Syntax_(programming_languages)https://en.wikipedia.org/wiki/Computer_languagehttps://en.wikipedia.org/wiki/Computer_languagehttps://en.wikipedia.org/wiki/Context-free_grammarhttps://en.wikipedia.org/wiki/Affixhttps://en.wikipedia.org/wiki/Agreement_(linguistics)https://en.wikipedia.org/wiki/Context-free_grammarhttps://en.wikipedia.org/wiki/Grammatical_number
  • 24 CHAPTER 8. AFFIX GRAMMAR

    8.2 Types of affix grammars

    In the simplest type of affix grammar, affixes can only take values from a finite domain, and affix values can only berelated through agreement, as in the example. Applied in this way, affixes increase compactness of grammars, but donot add expressive power.Another approach is to allow affixes to take arbitrary strings as values and allow concatenations of affixes to be used inrules. The ranges of allowable values for affixes can be described with context-free grammar rules. This produces theformalism of two-level grammars, also known as Van Wijngaarden grammars or 2VW grammars. These have beensuccessfully used to describe complicated languages, in particular, the syntax of the Algol 68 programming language.However, it turns out that, even though affix values can only be manipulated with string concatenation, this formalismis Turing complete; hence, even the most basic questions about the language described by an arbitrary 2VW grammarare undecidable in general.Extended Affix Grammars, developed in the 1980s, are a more restricted version of the same idea. They were mainlyapplied to describe the grammar of natural language, e.g. English.Another possibility is to allow the values of affixes to be computed by code written in some programming language.Two basic approaches have been used:

    In attribute grammars, the affixes (called attributes) can take values from arbitrary domains (e.g. integer or realnumbers, complex data structures) and arbitrary functions can be specified, written in a language of choice, todescribe how affix values in rules are derived from each other.

    In CDL (the Compiler Description Language) and its successor CDL2, developed in the 1970s, fragments ofsource code (usually in assembly language) can be used in rules instead of normal right-hand sides, allowingprimitives for input scanning and affix value computations to be expressed directly. Designed as a basis forpractical compiler construction, this approach was used to write compilers, and other software, e.g. a texteditor.

    8.3 See also Extended Affix Grammar

    Attribute grammar

    Van Wijngaarden grammar

    8.4 References

    https://en.wikipedia.org/wiki/Two-level_grammarhttps://en.wikipedia.org/wiki/Van_Wijngaarden_grammarhttps://en.wikipedia.org/wiki/Algol_68https://en.wikipedia.org/wiki/Programming_languagehttps://en.wikipedia.org/wiki/Turing_completehttps://en.wikipedia.org/wiki/Undecidable_languagehttps://en.wikipedia.org/wiki/Extended_Affix_Grammarhttps://en.wikipedia.org/wiki/Attribute_grammarhttps://en.wikipedia.org/wiki/Compiler_Description_Languagehttps://en.wikipedia.org/wiki/CDL2https://en.wikipedia.org/wiki/Assembly_languagehttps://en.wikipedia.org/wiki/Compilerhttps://en.wikipedia.org/wiki/Text_editorhttps://en.wikipedia.org/wiki/Text_edito

Related Documents