pure and declarative syntax definition: paradise lost and regained
DESCRIPTION
These are the slides from the presentation of our Onward! 2010 essay "Pure and Declarative Syntax Definition: Paradise Lost and Regained" at SPLASH.TRANSCRIPT
![Page 1: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/1.jpg)
Pure and Declarative Syntax Definition:
Paradise Lost and Regained
Lennart Kats Eelco Visser Guido Wachsmuth
Delft University of Technology
![Page 2: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/2.jpg)
![Page 3: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/3.jpg)
PARADISE
![Page 4: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/4.jpg)
PARADISE LOST
![Page 5: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/5.jpg)
PARADISE REGAINED
![Page 6: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/6.jpg)
PARADISE DENIED
![Page 7: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/7.jpg)
PARADISE
![Page 8: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/8.jpg)
WORDS
![Page 9: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/9.jpg)
TREES
![Page 10: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/10.jpg)
GRAMMARS
![Page 11: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/11.jpg)
LANGUAGE ENGINEERS
![Page 12: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/12.jpg)
LANGUAGES
![Page 13: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/13.jpg)
GRAMMARS
![Page 14: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/14.jpg)
NATURAL
![Page 15: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/15.jpg)
PURE
![Page 16: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/16.jpg)
BEAUTIFUL
![Page 17: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/17.jpg)
SOFTWARE ENGINEERS
![Page 18: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/18.jpg)
LANGUAGE SOFTWARE
![Page 19: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/19.jpg)
NATURAL
NOT
![Page 20: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/20.jpg)
PURE
NOT
![Page 21: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/21.jpg)
BEAUTIFUL
NOT
![Page 22: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/22.jpg)
SYNTAX DEFINITIONS
![Page 23: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/23.jpg)
NATURAL
![Page 24: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/24.jpg)
PURE
![Page 25: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/25.jpg)
BEAUTIFUL
![Page 26: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/26.jpg)
THE FALL
![Page 27: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/27.jpg)
PARSER DEFINITIONS
![Page 28: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/28.jpg)
PARADISE LOST
![Page 29: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/29.jpg)
PAIN
![Page 30: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/30.jpg)
SWEAT
![Page 31: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/31.jpg)
NATURAL
NOT
![Page 32: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/32.jpg)
PURE
NOT
![Page 33: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/33.jpg)
BEAUTIFUL
NOT
![Page 34: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/34.jpg)
THE PLAGUES
![Page 35: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/35.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
GRAMMAR CLASSES
![Page 36: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/36.jpg)
DISAMBIGUATION
![Page 37: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/37.jpg)
LEXICAL SYNTAX
![Page 38: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/38.jpg)
TREE CONSTRUCTION
![Page 39: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/39.jpg)
EVOLUTION
![Page 40: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/40.jpg)
COMPOSITION
![Page 41: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/41.jpg)
RESTRICTION TO PARSERS
![Page 42: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/42.jpg)
![Page 43: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/43.jpg)
PARADISE
![Page 44: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/44.jpg)
WORDS WERE MADE THROUGH
GRAMMARS
![Page 45: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/45.jpg)
GRAMMARS
![Page 46: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/46.jpg)
Num ➝ Digit NumNum ➝ DigitDigit ➝ “0”Digit ➝ “1”
![Page 47: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/47.jpg)
Num ➝ Digit NumNum ➝ DigitDigit ➝ “0”Digit ➝ “1”
production rules
![Page 48: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/48.jpg)
Num ➝ Digit NumNum ➝ DigitDigit ➝ “0”Digit ➝ “1”
terminal symbolsproduction rules
![Page 49: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/49.jpg)
Num ➝ Digit NumNum ➝ DigitDigit ➝ “0”Digit ➝ “1”
nonterminal symbolsterminal symbolsproduction rules
![Page 50: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/50.jpg)
Num ➝ Digit NumNum ➝ DigitDigit ➝ “0”Digit ➝ “1”
nonterminal symbolsterminal symbolsproduction rules
start symbol
![Page 51: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/51.jpg)
WORDS
![Page 52: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/52.jpg)
Num
![Page 53: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/53.jpg)
NumDigit Num
Num ➝ Digit Num
![Page 54: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/54.jpg)
NumDigit NumDigit Digit
Num ➝ Digit NumNum ➝ Digit
![Page 55: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/55.jpg)
NumDigit NumDigit DigitDigit 0
Num ➝ Digit NumNum ➝ DigitDigit ➝ “0”
![Page 56: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/56.jpg)
NumDigit NumDigit DigitDigit 01 0
Num ➝ Digit NumNum ➝ DigitDigit ➝ “0”Digit ➝ “1”
![Page 57: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/57.jpg)
SENTENCES
![Page 58: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/58.jpg)
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ Num
production rules
![Page 59: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/59.jpg)
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ Num
terminal symbolsproduction rules
![Page 60: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/60.jpg)
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ Num
nonterminal symbolsterminal symbolsproduction rules
![Page 61: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/61.jpg)
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ Num
nonterminal symbolsterminal symbolsproduction rules
start symbol
![Page 62: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/62.jpg)
Exp
![Page 63: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/63.jpg)
ExpExp + Exp
Exp ➝ Exp “+” Exp
![Page 64: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/64.jpg)
ExpExp + ExpExp * Exp + Exp
Exp ➝ Exp “+” ExpExp ➝ Exp “*” Exp
![Page 65: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/65.jpg)
ExpExp + ExpExp * Exp + Exp3 * Exp + Exp
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ Num
![Page 66: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/66.jpg)
ExpExp + ExpExp * Exp + Exp3 * Exp + Exp3 * 7 + Exp
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ NumExp ➝ Num
![Page 67: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/67.jpg)
ExpExp + ExpExp * Exp + Exp3 * Exp + Exp3 * 7 + Exp3 * 7 + 21
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ NumExp ➝ NumExp ➝ Num
![Page 68: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/68.jpg)
THEY MADE LANGUAGESBY MAKING GRAMMARS
![Page 69: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/69.jpg)
GRAMMAR
![Page 70: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/70.jpg)
LANGUAGE
![Page 71: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/71.jpg)
TRUTH
![Page 72: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/72.jpg)
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ Num
Exp “+” Exp ➝ ExpExp “*” Exp ➝ Exp
Num ➝ Exp
productive reductive
![Page 73: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/73.jpg)
3 * 7 + 21
![Page 74: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/74.jpg)
3 * 7 + 21 3 * 7 + Exp
Num ➝ Exp
![Page 75: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/75.jpg)
3 * 7 + 21 3 * 7 + Exp 3 * Exp + Exp
Num ➝ ExpNum ➝ Exp
![Page 76: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/76.jpg)
3 * 7 + 21 3 * 7 + Exp 3 * Exp + Exp Exp * Exp + Exp
Num ➝ ExpNum ➝ ExpNum ➝ Exp
![Page 77: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/77.jpg)
3 * 7 + 21 3 * 7 + Exp 3 * Exp + Exp Exp * Exp + ExpExp + Exp
Num ➝ ExpNum ➝ ExpNum ➝ Exp
Exp “*” Exp ➝ Exp
![Page 78: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/78.jpg)
3 * 7 + 21 3 * 7 + Exp 3 * Exp + Exp Exp * Exp + ExpExp + Exp Exp
Num ➝ ExpNum ➝ ExpNum ➝ Exp
Exp “*” Exp ➝ ExpExp “+” Exp ➝ Exp
![Page 79: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/79.jpg)
THEY TURNED WORDS INTO
TREES
![Page 80: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/80.jpg)
SENTENCES
![Page 81: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/81.jpg)
STRUCTURE
![Page 82: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/82.jpg)
Exp ➝ Exp “+” ExpExp ➝ Exp “*” ExpExp ➝ Num
Exp “+” Exp ➝ ExpExp “*” Exp ➝ Exp
Num ➝ Exp
productive reductive
![Page 83: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/83.jpg)
Exp
Num
Exp
+Exp Exp
Exp
*Exp Exp
tree construction
![Page 84: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/84.jpg)
3 * +7 21
![Page 85: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/85.jpg)
Exp Exp
3 * +7 21
Exp
Exp
Num
![Page 86: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/86.jpg)
Exp
Exp
Exp
3 * +7 21
Exp
Exp
+Exp Exp
Exp
*Exp Exp
![Page 87: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/87.jpg)
Exp
Exp
Exp
3 * +7 21
Exp
Exp
Exp
+Exp Exp
![Page 88: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/88.jpg)
ONE FORMALISM
![Page 89: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/89.jpg)
THREE READINGS
![Page 90: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/90.jpg)
PURE
![Page 91: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/91.jpg)
DECLARATIVE
![Page 92: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/92.jpg)
BEAUTIFUL
![Page 93: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/93.jpg)
PARADISE LOST
![Page 94: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/94.jpg)
EFFICIENCY
![Page 95: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/95.jpg)
THE FIRST PLAGUE WERE
GRAMMAR CLASSES
![Page 96: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/96.jpg)
context-free grammars
![Page 97: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/97.jpg)
context-free grammars
LL(0)
![Page 98: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/98.jpg)
context-free grammars
LL(1)
LL(0)
![Page 99: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/99.jpg)
context-free grammars
LL(k)
LL(1)
LL(0)
![Page 100: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/100.jpg)
context-free grammars
LR(0)
LL(k)
LL(1)
LL(0)
![Page 101: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/101.jpg)
context-free grammars
LR(1)
LR(0)
LL(k)
LL(1)
LL(0)
![Page 102: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/102.jpg)
context-free grammars
LR(k)
LR(1)
LR(0)
LL(k)
LL(1)
LL(0)
![Page 103: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/103.jpg)
context-free grammars
LR(k)
LR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 104: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/104.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 105: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/105.jpg)
Exp “+” Exp ➝ ExpExp “*” Exp ➝ Exp
Num ➝ Exp
Term (“+” Term)* ➝ ExpFact (“*” Fact)* ➝ Term
Num ➝ Fact
paradise grammar classes
![Page 106: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/106.jpg)
Exp
Exp
Exp
3 + +7 21
Exp
Exp
paradise grammar classes
Fact Fact
3 + +7 21
Fact
*
Exp
Term Term Term
*
![Page 107: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/107.jpg)
THE SECOND PLAGUE WAS
DISAMBIGUATION
![Page 108: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/108.jpg)
Exp
Exp
Exp
3 * +7 21
Exp
Exp
Exp
Exp
Exp
3 * +7 21
Exp
Exp
![Page 109: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/109.jpg)
text books
precedence operators associativity
1 ( ), [ ] non-associative
2 new non-associative
3 . left-associative
4 ++, -- non-associative
5 -, +, !, ~, ++, --, (type) right-associative
6 *, /, % left-associative
7 +, - left-associative
… … …
![Page 110: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/110.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 111: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/111.jpg)
context-free grammars
unambigous
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 112: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/112.jpg)
Exp “+” Term ➝ ExpTerm ➝ Exp
Term “*” Fact ➝ Term Fact ➝ TermNum ➝ Fact
grammar classes
![Page 113: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/113.jpg)
FALSE PROPHETS
![Page 114: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/114.jpg)
“a” “b” ➝ A“a” ➝ A
“a” “b” / “a” ➝ A
paradise PEGs
L = {ab, a} L = {ab, a}
![Page 115: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/115.jpg)
“a” ➝ A “a” “b” ➝ A
“a” / “a” “b” ➝ A
paradise PEGs
L = {ab, a} L = {a}
![Page 116: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/116.jpg)
if c1 then if c2 then s1 else s2
dangling else
![Page 117: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/117.jpg)
“if ” E “then” S “else” S / “if ” E “then” S ➝ S
“if ” E “then” S / “if ” E “then” S “else” S ➝ S
PEGs
![Page 118: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/118.jpg)
THE THIRD PLAGUE WAS
LEXICAL SYNTAX
![Page 119: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/119.jpg)
morphology & syntax
![Page 120: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/120.jpg)
limited look-ahead
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 121: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/121.jpg)
scanners
![Page 122: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/122.jpg)
3 * +7 21
![Page 123: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/123.jpg)
3 * +7 21
![Page 124: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/124.jpg)
parsers
![Page 125: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/125.jpg)
3 * +7 21
![Page 126: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/126.jpg)
Exp
Exp
Exp
3 * +7 21
Exp
Exp
![Page 127: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/127.jpg)
array [ ..1 10 ] integerof
x = *1. .10
y :
![Page 128: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/128.jpg)
array [ ..1 10 ] integerof
x = *1. .10
y :
![Page 129: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/129.jpg)
array [ 1. .10 ] integerof
x = *1. .10
y :
![Page 130: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/130.jpg)
THE FOURTH PLAGUE WAS
TREE CONSTRUCTION
![Page 131: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/131.jpg)
Exp
Exp
Exp
3 + +7 21
Exp
Exp
Const
Add
Const
3 7 21
Const
Add
paradise
![Page 132: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/132.jpg)
Const
Add
Const
3 7 21
Const
Add
Fact Fact
3 + +7 21
Fact
*
Exp
Term Term Term
*
grammar classes
![Page 133: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/133.jpg)
expr: INTEGER { $$ = con($1); }| expr '+' expr { $$ = opr('+', 2, $1, $3);}| expr '*' expr { $$ = opr('*', 2, $1, $3);};
semantic actions
![Page 134: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/134.jpg)
THE FIFTH PLAGUE WAS
EVOLUTION
![Page 135: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/135.jpg)
Exp “+” Exp ➝ ExpExp “*” Exp ➝ Exp
Num ➝ Exp
Exp “+” Term ➝ ExpTerm ➝ Exp
Term “*” Fact ➝ Term Fact ➝ TermNum ➝ Fact
paradise grammar classes
![Page 136: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/136.jpg)
Exp “+” Exp ➝ ExpExp “*” Exp ➝ Exp
Num ➝ Exp
Exp “=” Exp ➝ ExpExp “<” Exp ➝ ExpExp “>” Exp ➝ Exp
CExp “+” Term ➝ CExpTerm ➝ CExp
Term “*” Fact ➝ Term Fact ➝ TermNum ➝ Fact
Exp “=” CExp ➝ ExpExp “<” CExp ➝ ExpExp “>” CExp ➝ Exp
CExp ➝ Exp
paradise grammar classes
![Page 137: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/137.jpg)
THE SIXTH PLAGUE WAS
COMPOSITION
![Page 138: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/138.jpg)
parsers
![Page 139: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/139.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 140: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/140.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 141: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/141.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 142: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/142.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 143: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/143.jpg)
scanners
![Page 144: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/144.jpg)
public boolean authenticate(String user, String pw) {
SQL stm = <| SELECT id FROM Users WHERE name = ${user} AND password = ${pw} |>;
return executeQuery(stm).size() != 0;}
![Page 145: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/145.jpg)
THE SEVENTH PLAGUE WAS
RESTRICTION TO
PARSERS
![Page 146: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/146.jpg)
PRETTY PRINTERS
![Page 147: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/147.jpg)
SENTENCE GENERATORS
![Page 148: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/148.jpg)
AST ACCESS
![Page 149: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/149.jpg)
IDE SUPPORT
![Page 150: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/150.jpg)
PARADISE REGAINED
![Page 151: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/151.jpg)
GENERALISED
PARSING
![Page 152: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/152.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 153: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/153.jpg)
context-free grammars
![Page 154: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/154.jpg)
paradise SDF
context-free syntax
Exp "+" Exp -> Exp Exp "*" Exp -> Exp NUM -> Exp
Exp “+” Exp ➝ ExpExp “*” Exp ➝ Exp
Num ➝ Exp
![Page 155: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/155.jpg)
DECLARATIVE
DISAMBIGUATION
![Page 156: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/156.jpg)
context-free grammars
unambigous
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 157: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/157.jpg)
context-free grammars
unambigous
![Page 158: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/158.jpg)
context-free grammars
![Page 159: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/159.jpg)
text books
precedence operators associativity
1 ( ), [ ] non-associative
2 new non-associative
3 . left-associative
4 ++, -- non-associative
5 -, +, !, ~, ++, --, (type) right-associative
6 *, /, % left-associative
7 +, - left-associative
… … …
![Page 160: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/160.jpg)
context-free priorities Exp "*" Exp -> Exp {left}> Exp "+" Exp -> Exp {left}
![Page 161: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/161.jpg)
context-free syntax "if" E "then" S -> S {prefer} "if" E "then" S "else" S -> S
![Page 162: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/162.jpg)
SCANNERLESS
PARSING
![Page 163: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/163.jpg)
morphology & syntax
![Page 164: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/164.jpg)
lexical syntax [0-9]+ -> NUM
[\ \t\n] -> LAYOUT "//" ~[\n]* [\n] -> LAYOUT
![Page 165: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/165.jpg)
parser
![Page 166: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/166.jpg)
parser
![Page 167: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/167.jpg)
DECLARATIVE
TREE CONSTRUCTION
![Page 168: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/168.jpg)
Exp
Exp
Exp
3 + +7 21
Exp
Exp
Const
Add
Const
3 7 21
Const
Add
paradise
![Page 169: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/169.jpg)
SDF
context-free syntax Exp "+" Exp -> Exp {cons("Add")} Exp "*" Exp -> Exp {cons("Mul")} NUM -> Exp {cons("Const")}
![Page 170: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/170.jpg)
Const
Add
Const
3 7 21
Const
Add
paradise SDF
Add( Add( Const("3"), Const("7") ), Const("21"))
![Page 171: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/171.jpg)
SEAMLESS
EVOLUTION
![Page 172: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/172.jpg)
context-free syntax Exp "+" Exp -> Exp {cons("Add")} Exp "*" Exp -> Exp {cons("Mul")} NUM -> Exp {cons("Const")} Exp "=" Exp -> Exp {cons("Eq")} Exp ">" Exp -> Exp {cons("Gt")} Exp "<" Exp -> Exp {cons("Lt")}
![Page 173: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/173.jpg)
MODULAR
COMPOSITION
![Page 174: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/174.jpg)
context-free grammars
LR(k)
LR(1)
LALR(1)
SLR
LR(0)
LL(k)
LL(1)
LL(0)
![Page 175: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/175.jpg)
context-free grammars
![Page 176: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/176.jpg)
public boolean authenticate(String user, String pw) {
SQL stm = <| SELECT id FROM Users WHERE name = ${user} AND password = ${pw} |>;
return executeQuery(stm).size() != 0;}
![Page 177: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/177.jpg)
module Java-SQL imports Java SQL
exports context-free syntax
"<|" Query "|>" -> Exp {cons("ToSQL")} "${" Exp "}" -> SqlExp {cons("FromSQL")}
![Page 178: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/178.jpg)
BEYOND
PARSERS
![Page 179: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/179.jpg)
PRETTY PRINTERS
![Page 180: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/180.jpg)
SENTENCEGENERATORS
![Page 181: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/181.jpg)
AST ACCESS
![Page 182: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/182.jpg)
IDE SUPPORT
![Page 183: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/183.jpg)
PARADISE DENIED
![Page 184: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/184.jpg)
still around
![Page 185: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/185.jpg)
still around
![Page 186: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/186.jpg)
still have to use it
![Page 187: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/187.jpg)
still have to learnLL, LR, SLR, LALR
![Page 188: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/188.jpg)
still think using parser generators is hard
![Page 189: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/189.jpg)
modern parser generator
![Page 190: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/190.jpg)
modern parser generator
![Page 191: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/191.jpg)
PARADISE OPEN
![Page 192: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/192.jpg)
![Page 193: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/193.jpg)
slides title author copyright
1, 2, 42 Jeremiah lamenting Rembrandt public domain
3, 7, 14-16, 19-21, 23-25, 31-33, 43, 88-92
Adam and Eve in the Garden of Eden Wenzel Peterphoto: Jonathan Linczak some rights reserved
4, 28, 93 Expulsion from the Garden of Eden Thomas Cole public domain
5, 138, 175 Livres d'heures des Étienne Chevalier Jean Fouquet public domain
6, 167 The Adoration of the Golden Calf Nicolas Poussin public domain
8, 51, 112, 131, 150 Thesaurus Enoch Lau some rights reserved
9, 79, 81 The Burmis Tree Monsieur david some rights reserved
10, 13, 22, 45, 69 Latin Grammar Anthony Nelzin some rights reserved
11, 17, 176 The Garden of Earthly Delights (centre panel) Hieronymus Bosch public domain
12, 18, 68 Programming language textbooks K.lee public domain
26 The Fall of Man Jacob Jordaens public domain
27 Illustration d'après un Bison naturalisé d'Eulalie en Margeride F Lamiot some rights reserved
29 Can't Concentrate Sasha Wolff some rights reserved
30 Cold Sweat Eric Tastad some rights reserved
34 The Fifth Plague of Egypt Joseph M. W. Turner public domain
36 Managed Destruction Harley Kingston some rights reserved
![Page 194: Pure and Declarative Syntax Definition: Paradise Lost and Regained](https://reader031.vdocuments.us/reader031/viewer/2022020920/546e7cafaf7959ed6d8b6a9a/html5/thumbnails/194.jpg)
slides title author copyright
37 Book Scanner Ben Woosley some rights reserved
38 Dead trees in the clay pan of the Deadvlei Harald Süpfle some rights reserved
39 Charles Robert Darwin John Maler Collier public domain
40 Black Lego Wallpaper monohex some rights reserved
41 Four - Nova Prospekt (Restricted) |Digressive| some rights reserved
44, 110, 148 Noam Chomsky Fellowsisters some rights reserved
57, 80, 115, 129, 151 Minuscule 798 f.41v - f.42r unknown public domain
70 Latin Bible Gerard Brilsphoto: Adrian Pingstone public domain
71 Themis and Aegeus Kodros Painterphoto: Bibi Saint-Pol public domain
94 IBM System/3 Jonathunder some rights reserved
104 Destruction of the Beast and the False Prophet Benjamin West public domain
168 lex & yacc O’Reilly all rights reserved
169 flex & bison O’Reilly all rights reserved
170-172 Students TU Delft Media Services all rights reserved
173 ANTLR The Pragmatic Bookshelf all rights reserved
174 Xtext all rights reserved