SlideShare a Scribd company logo
IN4303 2016-2017
Compiler Construction
Formal Grammars
language specification
Guido Wachsmuth, Eelco Visser
Formal Grammars 2
3 * +7 21
3 * +7 21
Exp ExpExp
Exp
Exp
parser
Formal Grammars 3
syntax
definition
errors
parse generate
check
parse
table
generic
parser
Formal Grammars
Stratego
DynSem
NaBL2
SDF3
ESV
editor
SPT
tests
4
syntax definition
concrete syntax
abstract syntax
static semantics
name binding
type system
dynamic semantics
translation
interpretation
Formal Grammars
Stratego
DynSem
NaBL2
SDF3
ESV
editor
SPT
tests
5
syntax definition
concrete syntax
abstract syntax
static semantics
name binding
type system
dynamic semantics
translation
interpretation
Formal Grammars
Stratego
DynSem
NaBL2
SDF3
ESV
editor
SPT
tests
6
syntax definition
concrete syntax
abstract syntax
static semantics
name binding
type system
dynamic semantics
translation
interpretation
Formal Grammars 7
P A R E N T A L
ADVISORY
THEORETICAL CONTENT
Formal Grammars 8
formal languages
Formal Grammars 9
infinite productivity
Formal Grammars 10
finite models
Formal Grammars 11
Philosophy
Linguistics
lexicology
grammar
morphology
syntax
phonology
semantics
Interdisciplinary
Computer Science
syntax
semantics
Formal Grammars 12
Philosophy
Linguistics
lexicology
grammar
morphology
syntax
phonology
semantics
Interdisciplinary
Computer Science
syntax
semantics
Formal Grammars 13
Formal Grammars 13
vocabulary Σ
finite, nonempty set of elements (words, letters)
alphabet
Formal Grammars 13
vocabulary Σ
finite, nonempty set of elements (words, letters)
alphabet
string over Σ
finite sequence of elements chosen from Σ
word, sentence, utterance
Formal Grammars 13
vocabulary Σ
finite, nonempty set of elements (words, letters)
alphabet
string over Σ
finite sequence of elements chosen from Σ
word, sentence, utterance
formal language λ
set of strings over a vocabulary Σ
λ ⊆ Σ*
Formal Grammars 14
formal grammars
Formal Grammars 15
formal grammar G
derivation relation G
formal language L(G) ⊆ Σ*
L(G) = {w∈Σ*
| S G
*
w}
Formal Grammars 16
G = (N, Σ, P, S)
Num → Digit Num
Num → Digit
Digit → “0”
Digit → “1”
Digit → “2”
Digit → “3”
Digit → “4”
Digit → “5”
Digit → “6”
Digit → “7”
Digit → “8”
Digit → “9”
decimal numbers
morphology
Formal Grammars 17
G = (N, Σ, P, S)
Num → Digit Num
Num → Digit
Digit → “0”
Digit → “1”
Digit → “2”
Digit → “3”
Digit → “4”
Digit → “5”
Digit → “6”
Digit → “7”
Digit → “8”
Digit → “9”
decimal numbers
morphology
Σ: finite set of terminal symbols
Formal Grammars 18
G = (N, Σ, P, S)
Num → Digit Num
Num → Digit
Digit → “0”
Digit → “1”
Digit → “2”
Digit → “3”
Digit → “4”
Digit → “5”
Digit → “6”
Digit → “7”
Digit → “8”
Digit → “9”
decimal numbers
morphology
Σ: finite set of terminal symbols
N: finite set of non-terminal symbols
Formal Grammars 19
G = (N, Σ, P, S)
Num → Digit Num
Num → Digit
Digit → “0”
Digit → “1”
Digit → “2”
Digit → “3”
Digit → “4”
Digit → “5”
Digit → “6”
Digit → “7”
Digit → “8”
Digit → “9”
decimal numbers
morphology
Σ: finite set of terminal symbols
N: finite set of non-terminal symbols
S∈N: start symbol
Formal Grammars 20
G = (N, Σ, P, S)
Num → Digit Num
Num → Digit
Digit → “0”
Digit → “1”
Digit → “2”
Digit → “3”
Digit → “4”
Digit → “5”
Digit → “6”
Digit → “7”
Digit → “8”
Digit → “9”
decimal numbers
morphology
Σ: finite set of terminal symbols
N: finite set of non-terminal symbols
S∈N: start symbol
P⊆N×(N∪Σ)*
: set of production rules
Formal Grammars 21
Num
Digit Num
4 Num
4 Digit Num
4 3 Num
4 3 Digit Num
4 3 0 Num
4 3 0 Digit
4 3 0 3

Num → Digit Num
Digit → “4”
Num → Digit Num
Digit → “3”
Num → Digit Num
Digit → “0”
Num → Digit
Digit → “3”
decimal numbers
production
Formal Grammars 21
Num
Digit Num
4 Num
4 Digit Num
4 3 Num
4 3 Digit Num
4 3 0 Num
4 3 0 Digit
4 3 0 3

Num → Digit Num
Digit → “4”
Num → Digit Num
Digit → “3”
Num → Digit Num
Digit → “0”
Num → Digit
Digit → “3”
decimal numbers
production
leftmost derivation
Formal Grammars 22
Num
Digit Num
Digit Digit Num
Digit Digit Digit Num
Digit Digit Digit Digit
Digit Digit Digit 3
Digit Digit 0 3
Digit 3 0 3
4 3 0 3

Num → Digit Num
Num → Digit Num
Num → Digit Num
Num → Digit
Digit → “3”
Digit → “0”
Digit → “3”
Digit → “4”
decimal numbers
production
Formal Grammars 22
Num
Digit Num
Digit Digit Num
Digit Digit Digit Num
Digit Digit Digit Digit
Digit Digit Digit 3
Digit Digit 0 3
Digit 3 0 3
4 3 0 3

Num → Digit Num
Num → Digit Num
Num → Digit Num
Num → Digit
Digit → “3”
Digit → “0”
Digit → “3”
Digit → “4”
decimal numbers
production
rightmost derivation
Formal Grammars 23
G = (N, Σ, P, S)
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
binary expressions
syntax
Formal Grammars 24
G = (N, Σ, P, S)
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
binary expressions
syntax
Σ: finite set of terminal symbols
Formal Grammars 25
G = (N, Σ, P, S)
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
binary expressions
syntax
Σ: finite set of terminal symbols
N: finite set of non-terminal symbols
Formal Grammars 26
G = (N, Σ, P, S)
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
binary expressions
syntax
Σ: finite set of terminal symbols
N: finite set of non-terminal symbols
S∈N: start symbol
Formal Grammars 27
G = (N, Σ, P, S)
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
binary expressions
syntax
Σ: finite set of terminal symbols
N: finite set of non-terminal symbols
S∈N: start symbol
P⊆N×(N∪Σ)*
: set of production rules
Formal Grammars 28
Exp
Exp + Exp
Exp + Exp * Exp
3 + Exp * Exp
3 + 4 * Exp
3 + 4 * 5

Exp → Exp “+” Exp
Exp → Exp “*” Exp
Exp → Num
Exp → Num
Exp → Num
binary expressions
production
Formal Grammars 29
formal grammar G = (N, Σ, P, S)
nonterminal symbols N
terminal symbols Σ
production rules P ⊆ (N∪Σ)*
N (N∪Σ)*
× (N∪Σ)*
start symbol S∈N
Formal Grammars 29
formal grammar G = (N, Σ, P, S)
nonterminal symbols N
terminal symbols Σ
production rules P ⊆ (N∪Σ)*
N (N∪Σ)*
× (N∪Σ)*
start symbol S∈N
nonterminal symbol
Formal Grammars 29
formal grammar G = (N, Σ, P, S)
nonterminal symbols N
terminal symbols Σ
production rules P ⊆ (N∪Σ)*
N (N∪Σ)*
× (N∪Σ)*
start symbol S∈N
context
Formal Grammars 29
formal grammar G = (N, Σ, P, S)
nonterminal symbols N
terminal symbols Σ
production rules P ⊆ (N∪Σ)*
N (N∪Σ)*
× (N∪Σ)*
start symbol S∈N
replacement
Formal Grammars 29
formal grammar G = (N, Σ, P, S)
nonterminal symbols N
terminal symbols Σ
production rules P ⊆ (N∪Σ)*
N (N∪Σ)*
× (N∪Σ)*
start symbol S∈N
Formal Grammars 30
type-0, unrestricted: P ⊆ (N∪Σ)*
N (N∪Σ)*
× (N∪Σ)*
type-1, context-sensitive: (a A c, a b c)
type-2, context-free: P ⊆ N × (N∪Σ)*
type-3, regular: (A, x) or (A, xB)
Formal Grammars 31
formal grammars
context-sensitive
context-free
regular
Formal Grammars 32
formal grammar G
derivation relation G
formal language L(G) ⊆ Σ*
L(G) = {w∈Σ*
| S G
*
w}
Formal Grammars 33
formal grammar G = (N, Σ, P, S)
derivation relation G ⊆ (N∪Σ)*
× (N∪Σ)*
w G w’
∃(p, q)∈P: ∃u,v∈(N∪Σ)*
:
w=u p v ∧ w’=u q v
formal language L(G) ⊆ Σ*
L(G) = {w∈Σ*
| S G
*
w}
Formal Grammars 34
formal languages
context-sensitive
context-free
regular
Formal Grammars 35
3 * +7 21
3 * +7 21
Exp ExpExp
Exp
Exp
parser
Derivation is about productivity.
But what about parsing?
Formal Grammars 36
word problem
Formal Grammars 37
word problem χL: Σ*
→ {0,1}
w → 1, if w∈L
w → 0, else
theoretical computer science
decidability & complexity
Formal Grammars 37
word problem χL: Σ*
→ {0,1}
w → 1, if w∈L
w → 0, else
decidability
type-0: semi-decidable
type-1, type-2, type-3: decidable
theoretical computer science
decidability & complexity
Formal Grammars 37
word problem χL: Σ*
→ {0,1}
w → 1, if w∈L
w → 0, else
decidability
type-0: semi-decidable
type-1, type-2, type-3: decidable
complexity
type-1: PSPACE-complete
type-2, type-3: P
theoretical computer science
decidability & complexity
Formal Grammars 37
word problem χL: Σ*
→ {0,1}
w → 1, if w∈L
w → 0, else
decidability
type-0: semi-decidable
type-1, type-2, type-3: decidable
complexity
type-1: PSPACE-complete
type-2, type-3: P
theoretical computer science
decidability & complexity
PSPACE⊇NP⊇P
Formal Grammars 38
formal grammars
context-sensitive
context-free
regular
theoretical computer science
decidability & complexity
Formal Grammars 38
formal grammars
context-sensitive
context-free
regular
theoretical computer science
decidability & complexity
Formal Grammars 38
formal grammars
context-sensitive
context-free
regular
theoretical computer science
decidability & complexity
Formal Grammars 39
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
context-free grammars
production vs. reduction rules
Formal Grammars 39
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
context-free grammars
production vs. reduction rules
productive form
Formal Grammars 39
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
Num → Exp
Exp “+” Exp → Exp
Exp “−” Exp → Exp
Exp “*” Exp → Exp
Exp “/” Exp → Exp
“(” Exp “)” → Exp
context-free grammars
production vs. reduction rules
productive form
Formal Grammars 39
Exp → Num
Exp → Exp “+” Exp
Exp → Exp “−” Exp
Exp → Exp “*” Exp
Exp → Exp “/” Exp
Exp → “(” Exp “)”
Num → Exp
Exp “+” Exp → Exp
Exp “−” Exp → Exp
Exp “*” Exp → Exp
Exp “/” Exp → Exp
“(” Exp “)” → Exp
context-free grammars
production vs. reduction rules
productive form reductive form
Formal Grammars 40
3 + 4 * 5
Exp + 4 * 5
Exp + Exp * 5
Exp + Exp * Exp
Exp + Exp
Exp

Num → Exp
Num → Exp
Num → Exp
Exp “*” Exp → Exp
Exp “+” Exp → Exp
binary expressions
reduction
Formal Grammars 41
3 * +7 21
3 * +7 21
Exp ExpExp
Exp
Exp
parser
The word problem is about membership.
But what about structure?
Formal Grammars 42
syntax trees
Formal Grammars 43
Exp
Num
Exp
+Exp Exp
Exp
−Exp Exp
Exp
*Exp Exp
Exp
/Exp Exp
Exp
Exp( )
context-free grammars
tree construction rules
Formal Grammars 44
binary expressions
tree construction
3 + *4 5
Formal Grammars 44
binary expressions
tree construction
Exp
3 + *4 5
Formal Grammars 44
binary expressions
tree construction
Exp Exp
3 + *4 5
Formal Grammars 44
binary expressions
tree construction
Exp Exp
3 + *4 5
Exp
Formal Grammars 44
binary expressions
tree construction
Exp
Exp
Exp
3 + *4 5
Exp
Formal Grammars 44
binary expressions
tree construction
Exp
Exp
Exp
3 + *4 5
Exp
Exp
Formal Grammars 45
binary expressions
ambiguity
Exp
Exp
Exp
3 + *4 5
Exp
Exp
Exp
Exp
Exp
3 + *4 5
Exp
Exp
Formal Grammars 46
syntax trees
different trees for same sentence
derivations
different leftmost derivations for same sentence
different rightmost derivations for same sentence
NOT just different derivations for same sentence
context-free grammars
ambiguity
Formal Grammars 47
parse trees
parent node: nonterminal symbol
child nodes: terminal symbols
abstract syntax trees (ASTs)
abstract over terminal symbols
convey information at parent nodes
abstract over injective production rules
syntax trees
parse trees & abstract syntax trees
Formal Grammars 48
binary expressions
parse tree & abstract syntax tree
Exp
Exp
Exp Exp
Exp
(3 + *4 5 )
Exp
Formal Grammars 48
binary expressions
parse tree & abstract syntax tree
Const
Mul
Const
3 4 5
Const
Add
Exp
Exp
Exp Exp
Exp
(3 + *4 5 )
Exp
Formal Grammars 49
Except where otherwise noted, this work is licensed under
Formal Grammars 50
attribution
slide title author license
1 The Pine, Saint Tropez Paul Signac public domain
2, 3, 35, 41 PICOL icons Melih Bilgil CC BY 3.0
9 Writing Caitlin Regan CC BY 2.0
10 Latin Grammar Anthony Nelzin
13, 15, 29-34, 38 Noam Chomsky Fellowsisters CC BY-NC-SA 2.0

More Related Content

What's hot

Lecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language TechnologyLecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language Technology
Marina Santini
 
Lexical analysis-using-lex
Lexical analysis-using-lexLexical analysis-using-lex
Lexical analysis-using-lex
Dattatray Gandhmal
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
Dilouar Hossain
 
Lefmost rightmost TOC.pptx
Lefmost rightmost TOC.pptxLefmost rightmost TOC.pptx
Lefmost rightmost TOC.pptx
Jisock
 
Regular Expression to Finite Automata
Regular Expression to Finite AutomataRegular Expression to Finite Automata
Regular Expression to Finite Automata
Archana Gopinath
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Kuppusamy P
 
Ch5a
Ch5aCh5a
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
Akshaya Arunan
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
Mohammed Sikander
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
Ratnakar Mikkili
 
LR Parsing
LR ParsingLR Parsing
LR Parsing
Eelco Visser
 
Semantic Analysis.pptx
Semantic Analysis.pptxSemantic Analysis.pptx
Semantic Analysis.pptx
ZarfaMasood
 
Semantic analysis
Semantic analysisSemantic analysis
Semantic analysis
Ibrahim Muneer
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
Mahbubur Rahman
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
Akshaya Arunan
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
United International University
 
Relationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & PatternRelationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & Pattern
Bharat Rathore
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
Rana Ehtisham Ul Haq
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
Bipul Roy Bpl
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
MAHASREEM
 

What's hot (20)

Lecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language TechnologyLecture 1: Semantic Analysis in Language Technology
Lecture 1: Semantic Analysis in Language Technology
 
Lexical analysis-using-lex
Lexical analysis-using-lexLexical analysis-using-lex
Lexical analysis-using-lex
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
 
Lefmost rightmost TOC.pptx
Lefmost rightmost TOC.pptxLefmost rightmost TOC.pptx
Lefmost rightmost TOC.pptx
 
Regular Expression to Finite Automata
Regular Expression to Finite AutomataRegular Expression to Finite Automata
Regular Expression to Finite Automata
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Ch5a
Ch5aCh5a
Ch5a
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
 
LR Parsing
LR ParsingLR Parsing
LR Parsing
 
Semantic Analysis.pptx
Semantic Analysis.pptxSemantic Analysis.pptx
Semantic Analysis.pptx
 
Semantic analysis
Semantic analysisSemantic analysis
Semantic analysis
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Relationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & PatternRelationship Among Token, Lexeme & Pattern
Relationship Among Token, Lexeme & Pattern
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 

Viewers also liked

Syntax Definition
Syntax DefinitionSyntax Definition
Syntax Definition
Eelco Visser
 
Pure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and RegainedPure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and Regained
Guido Wachsmuth
 
Formal Grammar and Style
Formal Grammar and StyleFormal Grammar and Style
Formal Grammar and Style
theLecturette
 
Term Rewriting
Term RewritingTerm Rewriting
Term Rewriting
Eelco Visser
 
Software languages
Software languagesSoftware languages
Software languages
Eelco Visser
 
Language
LanguageLanguage
Language
Guido Wachsmuth
 
Grammar
GrammarGrammar
Grammar
Naseem Akhtar
 
5th Semester (June-2016) Computer Science and Information Science Engineering...
5th Semester (June-2016) Computer Science and Information Science Engineering...5th Semester (June-2016) Computer Science and Information Science Engineering...
5th Semester (June-2016) Computer Science and Information Science Engineering...
BGS Institute of Technology, Adichunchanagiri University (ACU)
 
Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...
Jaap ter Woerds
 
Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with Netty
Daniel Bimschas
 
Programming languages
Programming languagesProgramming languages
Programming languages
Eelco Visser
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transfer
Victor Cherkassky
 
Writing Report Abstracts
Writing Report AbstractsWriting Report Abstracts
Writing Report Abstracts
theLecturette
 
System Programming Unit IV
System Programming Unit IVSystem Programming Unit IV
System Programming Unit IV
Manoj Patil
 
Grammar
GrammarGrammar
Grammar
sejalchauhan
 
Frank palmer semantics
Frank palmer  semanticsFrank palmer  semantics
Frank palmer semantics
AST-School
 
Comparison/ Contrast Essay
Comparison/ Contrast EssayComparison/ Contrast Essay
Comparison/ Contrast Essay
theLecturette
 
Transformational grammar
Transformational grammarTransformational grammar
Transformational grammar
Jack Feng
 
Semantics presentation
Semantics presentationSemantics presentation
Semantics presentation
Azmat Araa Malik
 
Grammar and its types
Grammar and its typesGrammar and its types
Grammar and its types
Asif Ali Raza
 

Viewers also liked (20)

Syntax Definition
Syntax DefinitionSyntax Definition
Syntax Definition
 
Pure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and RegainedPure and Declarative Syntax Definition: Paradise Lost and Regained
Pure and Declarative Syntax Definition: Paradise Lost and Regained
 
Formal Grammar and Style
Formal Grammar and StyleFormal Grammar and Style
Formal Grammar and Style
 
Term Rewriting
Term RewritingTerm Rewriting
Term Rewriting
 
Software languages
Software languagesSoftware languages
Software languages
 
Language
LanguageLanguage
Language
 
Grammar
GrammarGrammar
Grammar
 
5th Semester (June-2016) Computer Science and Information Science Engineering...
5th Semester (June-2016) Computer Science and Information Science Engineering...5th Semester (June-2016) Computer Science and Information Science Engineering...
5th Semester (June-2016) Computer Science and Information Science Engineering...
 
Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...
 
Zero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with NettyZero-Copy Event-Driven Servers with Netty
Zero-Copy Event-Driven Servers with Netty
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transfer
 
Writing Report Abstracts
Writing Report AbstractsWriting Report Abstracts
Writing Report Abstracts
 
System Programming Unit IV
System Programming Unit IVSystem Programming Unit IV
System Programming Unit IV
 
Grammar
GrammarGrammar
Grammar
 
Frank palmer semantics
Frank palmer  semanticsFrank palmer  semantics
Frank palmer semantics
 
Comparison/ Contrast Essay
Comparison/ Contrast EssayComparison/ Contrast Essay
Comparison/ Contrast Essay
 
Transformational grammar
Transformational grammarTransformational grammar
Transformational grammar
 
Semantics presentation
Semantics presentationSemantics presentation
Semantics presentation
 
Grammar and its types
Grammar and its typesGrammar and its types
Grammar and its types
 

Similar to Formal Grammars

Declarative Syntax Definition - Grammars and Trees
Declarative Syntax Definition - Grammars and TreesDeclarative Syntax Definition - Grammars and Trees
Declarative Syntax Definition - Grammars and Trees
Guido Wachsmuth
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
Eelco Visser
 
Compiler Components and their Generators - Traditional Parsing Algorithms
Compiler Components and their Generators - Traditional Parsing AlgorithmsCompiler Components and their Generators - Traditional Parsing Algorithms
Compiler Components and their Generators - Traditional Parsing Algorithms
Guido Wachsmuth
 
Compiler Components and their Generators - Lexical Analysis
Compiler Components and their Generators - Lexical AnalysisCompiler Components and their Generators - Lexical Analysis
Compiler Components and their Generators - Lexical Analysis
Guido Wachsmuth
 
LL Parsing
LL ParsingLL Parsing
LL Parsing
Eelco Visser
 
Declarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty PrintingDeclarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty Printing
Guido Wachsmuth
 
Ch2 (1).ppt
Ch2 (1).pptCh2 (1).ppt
Ch2 (1).ppt
daniloalbay1
 
Syntax Definition
Syntax DefinitionSyntax Definition
Syntax Definition
Guido Wachsmuth
 
Geometric Sequence and Series.pdf
Geometric Sequence and Series.pdfGeometric Sequence and Series.pdf
Geometric Sequence and Series.pdf
VnDr
 
Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...
Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...
Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...
MargieCDeSagun
 
Section 11-2 Algebra 2
Section 11-2 Algebra 2Section 11-2 Algebra 2
Section 11-2 Algebra 2
Jimbo Lamb
 
Static Analysis
Static AnalysisStatic Analysis
Static Analysis
Eelco Visser
 
Ch2
Ch2Ch2
Compiler components and their generators traditional parsing algorithms
Compiler components and their generators  traditional parsing algorithmsCompiler components and their generators  traditional parsing algorithms
Compiler components and their generators traditional parsing algorithms
PeshrowKareem1
 
Scope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languagesScope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languages
Eelco Visser
 
Arithmetic Sequences and Series.ppt
Arithmetic Sequences and Series.pptArithmetic Sequences and Series.ppt
Arithmetic Sequences and Series.ppt
John Marvin Canaria
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
Angelle Pantig
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
GIDEONPAUL13
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
reboy_arroyo
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
JosephMuez2
 

Similar to Formal Grammars (20)

Declarative Syntax Definition - Grammars and Trees
Declarative Syntax Definition - Grammars and TreesDeclarative Syntax Definition - Grammars and Trees
Declarative Syntax Definition - Grammars and Trees
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
Compiler Components and their Generators - Traditional Parsing Algorithms
Compiler Components and their Generators - Traditional Parsing AlgorithmsCompiler Components and their Generators - Traditional Parsing Algorithms
Compiler Components and their Generators - Traditional Parsing Algorithms
 
Compiler Components and their Generators - Lexical Analysis
Compiler Components and their Generators - Lexical AnalysisCompiler Components and their Generators - Lexical Analysis
Compiler Components and their Generators - Lexical Analysis
 
LL Parsing
LL ParsingLL Parsing
LL Parsing
 
Declarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty PrintingDeclarative Syntax Definition - Pretty Printing
Declarative Syntax Definition - Pretty Printing
 
Ch2 (1).ppt
Ch2 (1).pptCh2 (1).ppt
Ch2 (1).ppt
 
Syntax Definition
Syntax DefinitionSyntax Definition
Syntax Definition
 
Geometric Sequence and Series.pdf
Geometric Sequence and Series.pdfGeometric Sequence and Series.pdf
Geometric Sequence and Series.pdf
 
Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...
Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...
Class_Powerpoint_Sequences_Arithmetic_and_Geometric_with_Series_Finite_and_In...
 
Section 11-2 Algebra 2
Section 11-2 Algebra 2Section 11-2 Algebra 2
Section 11-2 Algebra 2
 
Static Analysis
Static AnalysisStatic Analysis
Static Analysis
 
Ch2
Ch2Ch2
Ch2
 
Compiler components and their generators traditional parsing algorithms
Compiler components and their generators  traditional parsing algorithmsCompiler components and their generators  traditional parsing algorithms
Compiler components and their generators traditional parsing algorithms
 
Scope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languagesScope Graphs: A fresh look at name binding in programming languages
Scope Graphs: A fresh look at name binding in programming languages
 
Arithmetic Sequences and Series.ppt
Arithmetic Sequences and Series.pptArithmetic Sequences and Series.ppt
Arithmetic Sequences and Series.ppt
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
 
Arithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.pptArithmetic Sequences and Series-Boger.ppt
Arithmetic Sequences and Series-Boger.ppt
 

More from Eelco Visser

CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
CS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic ServicesCS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic Services
Eelco Visser
 
CS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | ParsingCS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | Parsing
Eelco Visser
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
Eelco Visser
 
CS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionCS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: Introduction
Eelco Visser
 
A Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation RulesA Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation Rules
Eelco Visser
 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
Eelco Visser
 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionCompiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Eelco Visser
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Eelco Visser
 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory Management
Eelco Visser
 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | Interpreters
Eelco Visser
 
Compiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code GenerationCompiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code Generation
Eelco Visser
 
Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual Machines
Eelco Visser
 
Compiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone FrameworksCompiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone Frameworks
Eelco Visser
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
Eelco Visser
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
Eelco Visser
 
Compiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type ConstraintsCompiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type Constraints
Eelco Visser
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
Eelco Visser
 
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static AnalysisCompiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Eelco Visser
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 

More from Eelco Visser (20)

CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
 
CS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic ServicesCS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic Services
 
CS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | ParsingCS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | Parsing
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
 
CS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionCS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: Introduction
 
A Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation RulesA Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation Rules
 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionCompiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler Construction
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory Management
 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | Interpreters
 
Compiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code GenerationCompiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code Generation
 
Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual Machines
 
Compiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone FrameworksCompiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone Frameworks
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
 
Compiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type ConstraintsCompiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type Constraints
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
 
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static AnalysisCompiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static Analysis
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
 

Recently uploaded

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Envertis Software Solutions
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 

Recently uploaded (20)

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 

Formal Grammars

  • 1. IN4303 2016-2017 Compiler Construction Formal Grammars language specification Guido Wachsmuth, Eelco Visser
  • 2. Formal Grammars 2 3 * +7 21 3 * +7 21 Exp ExpExp Exp Exp parser
  • 3. Formal Grammars 3 syntax definition errors parse generate check parse table generic parser
  • 4. Formal Grammars Stratego DynSem NaBL2 SDF3 ESV editor SPT tests 4 syntax definition concrete syntax abstract syntax static semantics name binding type system dynamic semantics translation interpretation
  • 5. Formal Grammars Stratego DynSem NaBL2 SDF3 ESV editor SPT tests 5 syntax definition concrete syntax abstract syntax static semantics name binding type system dynamic semantics translation interpretation
  • 6. Formal Grammars Stratego DynSem NaBL2 SDF3 ESV editor SPT tests 6 syntax definition concrete syntax abstract syntax static semantics name binding type system dynamic semantics translation interpretation
  • 7. Formal Grammars 7 P A R E N T A L ADVISORY THEORETICAL CONTENT
  • 14. Formal Grammars 13 vocabulary Σ finite, nonempty set of elements (words, letters) alphabet
  • 15. Formal Grammars 13 vocabulary Σ finite, nonempty set of elements (words, letters) alphabet string over Σ finite sequence of elements chosen from Σ word, sentence, utterance
  • 16. Formal Grammars 13 vocabulary Σ finite, nonempty set of elements (words, letters) alphabet string over Σ finite sequence of elements chosen from Σ word, sentence, utterance formal language λ set of strings over a vocabulary Σ λ ⊆ Σ*
  • 18. Formal Grammars 15 formal grammar G derivation relation G formal language L(G) ⊆ Σ* L(G) = {w∈Σ* | S G * w}
  • 19. Formal Grammars 16 G = (N, Σ, P, S) Num → Digit Num Num → Digit Digit → “0” Digit → “1” Digit → “2” Digit → “3” Digit → “4” Digit → “5” Digit → “6” Digit → “7” Digit → “8” Digit → “9” decimal numbers morphology
  • 20. Formal Grammars 17 G = (N, Σ, P, S) Num → Digit Num Num → Digit Digit → “0” Digit → “1” Digit → “2” Digit → “3” Digit → “4” Digit → “5” Digit → “6” Digit → “7” Digit → “8” Digit → “9” decimal numbers morphology Σ: finite set of terminal symbols
  • 21. Formal Grammars 18 G = (N, Σ, P, S) Num → Digit Num Num → Digit Digit → “0” Digit → “1” Digit → “2” Digit → “3” Digit → “4” Digit → “5” Digit → “6” Digit → “7” Digit → “8” Digit → “9” decimal numbers morphology Σ: finite set of terminal symbols N: finite set of non-terminal symbols
  • 22. Formal Grammars 19 G = (N, Σ, P, S) Num → Digit Num Num → Digit Digit → “0” Digit → “1” Digit → “2” Digit → “3” Digit → “4” Digit → “5” Digit → “6” Digit → “7” Digit → “8” Digit → “9” decimal numbers morphology Σ: finite set of terminal symbols N: finite set of non-terminal symbols S∈N: start symbol
  • 23. Formal Grammars 20 G = (N, Σ, P, S) Num → Digit Num Num → Digit Digit → “0” Digit → “1” Digit → “2” Digit → “3” Digit → “4” Digit → “5” Digit → “6” Digit → “7” Digit → “8” Digit → “9” decimal numbers morphology Σ: finite set of terminal symbols N: finite set of non-terminal symbols S∈N: start symbol P⊆N×(N∪Σ)* : set of production rules
  • 24. Formal Grammars 21 Num Digit Num 4 Num 4 Digit Num 4 3 Num 4 3 Digit Num 4 3 0 Num 4 3 0 Digit 4 3 0 3
 Num → Digit Num Digit → “4” Num → Digit Num Digit → “3” Num → Digit Num Digit → “0” Num → Digit Digit → “3” decimal numbers production
  • 25. Formal Grammars 21 Num Digit Num 4 Num 4 Digit Num 4 3 Num 4 3 Digit Num 4 3 0 Num 4 3 0 Digit 4 3 0 3
 Num → Digit Num Digit → “4” Num → Digit Num Digit → “3” Num → Digit Num Digit → “0” Num → Digit Digit → “3” decimal numbers production leftmost derivation
  • 26. Formal Grammars 22 Num Digit Num Digit Digit Num Digit Digit Digit Num Digit Digit Digit Digit Digit Digit Digit 3 Digit Digit 0 3 Digit 3 0 3 4 3 0 3
 Num → Digit Num Num → Digit Num Num → Digit Num Num → Digit Digit → “3” Digit → “0” Digit → “3” Digit → “4” decimal numbers production
  • 27. Formal Grammars 22 Num Digit Num Digit Digit Num Digit Digit Digit Num Digit Digit Digit Digit Digit Digit Digit 3 Digit Digit 0 3 Digit 3 0 3 4 3 0 3
 Num → Digit Num Num → Digit Num Num → Digit Num Num → Digit Digit → “3” Digit → “0” Digit → “3” Digit → “4” decimal numbers production rightmost derivation
  • 28. Formal Grammars 23 G = (N, Σ, P, S) Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” binary expressions syntax
  • 29. Formal Grammars 24 G = (N, Σ, P, S) Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” binary expressions syntax Σ: finite set of terminal symbols
  • 30. Formal Grammars 25 G = (N, Σ, P, S) Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” binary expressions syntax Σ: finite set of terminal symbols N: finite set of non-terminal symbols
  • 31. Formal Grammars 26 G = (N, Σ, P, S) Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” binary expressions syntax Σ: finite set of terminal symbols N: finite set of non-terminal symbols S∈N: start symbol
  • 32. Formal Grammars 27 G = (N, Σ, P, S) Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” binary expressions syntax Σ: finite set of terminal symbols N: finite set of non-terminal symbols S∈N: start symbol P⊆N×(N∪Σ)* : set of production rules
  • 33. Formal Grammars 28 Exp Exp + Exp Exp + Exp * Exp 3 + Exp * Exp 3 + 4 * Exp 3 + 4 * 5
 Exp → Exp “+” Exp Exp → Exp “*” Exp Exp → Num Exp → Num Exp → Num binary expressions production
  • 34. Formal Grammars 29 formal grammar G = (N, Σ, P, S) nonterminal symbols N terminal symbols Σ production rules P ⊆ (N∪Σ)* N (N∪Σ)* × (N∪Σ)* start symbol S∈N
  • 35. Formal Grammars 29 formal grammar G = (N, Σ, P, S) nonterminal symbols N terminal symbols Σ production rules P ⊆ (N∪Σ)* N (N∪Σ)* × (N∪Σ)* start symbol S∈N nonterminal symbol
  • 36. Formal Grammars 29 formal grammar G = (N, Σ, P, S) nonterminal symbols N terminal symbols Σ production rules P ⊆ (N∪Σ)* N (N∪Σ)* × (N∪Σ)* start symbol S∈N context
  • 37. Formal Grammars 29 formal grammar G = (N, Σ, P, S) nonterminal symbols N terminal symbols Σ production rules P ⊆ (N∪Σ)* N (N∪Σ)* × (N∪Σ)* start symbol S∈N replacement
  • 38. Formal Grammars 29 formal grammar G = (N, Σ, P, S) nonterminal symbols N terminal symbols Σ production rules P ⊆ (N∪Σ)* N (N∪Σ)* × (N∪Σ)* start symbol S∈N
  • 39. Formal Grammars 30 type-0, unrestricted: P ⊆ (N∪Σ)* N (N∪Σ)* × (N∪Σ)* type-1, context-sensitive: (a A c, a b c) type-2, context-free: P ⊆ N × (N∪Σ)* type-3, regular: (A, x) or (A, xB)
  • 40. Formal Grammars 31 formal grammars context-sensitive context-free regular
  • 41. Formal Grammars 32 formal grammar G derivation relation G formal language L(G) ⊆ Σ* L(G) = {w∈Σ* | S G * w}
  • 42. Formal Grammars 33 formal grammar G = (N, Σ, P, S) derivation relation G ⊆ (N∪Σ)* × (N∪Σ)* w G w’ ∃(p, q)∈P: ∃u,v∈(N∪Σ)* : w=u p v ∧ w’=u q v formal language L(G) ⊆ Σ* L(G) = {w∈Σ* | S G * w}
  • 43. Formal Grammars 34 formal languages context-sensitive context-free regular
  • 44. Formal Grammars 35 3 * +7 21 3 * +7 21 Exp ExpExp Exp Exp parser Derivation is about productivity. But what about parsing?
  • 46. Formal Grammars 37 word problem χL: Σ* → {0,1} w → 1, if w∈L w → 0, else theoretical computer science decidability & complexity
  • 47. Formal Grammars 37 word problem χL: Σ* → {0,1} w → 1, if w∈L w → 0, else decidability type-0: semi-decidable type-1, type-2, type-3: decidable theoretical computer science decidability & complexity
  • 48. Formal Grammars 37 word problem χL: Σ* → {0,1} w → 1, if w∈L w → 0, else decidability type-0: semi-decidable type-1, type-2, type-3: decidable complexity type-1: PSPACE-complete type-2, type-3: P theoretical computer science decidability & complexity
  • 49. Formal Grammars 37 word problem χL: Σ* → {0,1} w → 1, if w∈L w → 0, else decidability type-0: semi-decidable type-1, type-2, type-3: decidable complexity type-1: PSPACE-complete type-2, type-3: P theoretical computer science decidability & complexity PSPACE⊇NP⊇P
  • 50. Formal Grammars 38 formal grammars context-sensitive context-free regular theoretical computer science decidability & complexity
  • 51. Formal Grammars 38 formal grammars context-sensitive context-free regular theoretical computer science decidability & complexity
  • 52. Formal Grammars 38 formal grammars context-sensitive context-free regular theoretical computer science decidability & complexity
  • 53. Formal Grammars 39 Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” context-free grammars production vs. reduction rules
  • 54. Formal Grammars 39 Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” context-free grammars production vs. reduction rules productive form
  • 55. Formal Grammars 39 Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” Num → Exp Exp “+” Exp → Exp Exp “−” Exp → Exp Exp “*” Exp → Exp Exp “/” Exp → Exp “(” Exp “)” → Exp context-free grammars production vs. reduction rules productive form
  • 56. Formal Grammars 39 Exp → Num Exp → Exp “+” Exp Exp → Exp “−” Exp Exp → Exp “*” Exp Exp → Exp “/” Exp Exp → “(” Exp “)” Num → Exp Exp “+” Exp → Exp Exp “−” Exp → Exp Exp “*” Exp → Exp Exp “/” Exp → Exp “(” Exp “)” → Exp context-free grammars production vs. reduction rules productive form reductive form
  • 57. Formal Grammars 40 3 + 4 * 5 Exp + 4 * 5 Exp + Exp * 5 Exp + Exp * Exp Exp + Exp Exp
 Num → Exp Num → Exp Num → Exp Exp “*” Exp → Exp Exp “+” Exp → Exp binary expressions reduction
  • 58. Formal Grammars 41 3 * +7 21 3 * +7 21 Exp ExpExp Exp Exp parser The word problem is about membership. But what about structure?
  • 60. Formal Grammars 43 Exp Num Exp +Exp Exp Exp −Exp Exp Exp *Exp Exp Exp /Exp Exp Exp Exp( ) context-free grammars tree construction rules
  • 61. Formal Grammars 44 binary expressions tree construction 3 + *4 5
  • 62. Formal Grammars 44 binary expressions tree construction Exp 3 + *4 5
  • 63. Formal Grammars 44 binary expressions tree construction Exp Exp 3 + *4 5
  • 64. Formal Grammars 44 binary expressions tree construction Exp Exp 3 + *4 5 Exp
  • 65. Formal Grammars 44 binary expressions tree construction Exp Exp Exp 3 + *4 5 Exp
  • 66. Formal Grammars 44 binary expressions tree construction Exp Exp Exp 3 + *4 5 Exp Exp
  • 67. Formal Grammars 45 binary expressions ambiguity Exp Exp Exp 3 + *4 5 Exp Exp Exp Exp Exp 3 + *4 5 Exp Exp
  • 68. Formal Grammars 46 syntax trees different trees for same sentence derivations different leftmost derivations for same sentence different rightmost derivations for same sentence NOT just different derivations for same sentence context-free grammars ambiguity
  • 69. Formal Grammars 47 parse trees parent node: nonterminal symbol child nodes: terminal symbols abstract syntax trees (ASTs) abstract over terminal symbols convey information at parent nodes abstract over injective production rules syntax trees parse trees & abstract syntax trees
  • 70. Formal Grammars 48 binary expressions parse tree & abstract syntax tree Exp Exp Exp Exp Exp (3 + *4 5 ) Exp
  • 71. Formal Grammars 48 binary expressions parse tree & abstract syntax tree Const Mul Const 3 4 5 Const Add Exp Exp Exp Exp Exp (3 + *4 5 ) Exp
  • 72. Formal Grammars 49 Except where otherwise noted, this work is licensed under
  • 73. Formal Grammars 50 attribution slide title author license 1 The Pine, Saint Tropez Paul Signac public domain 2, 3, 35, 41 PICOL icons Melih Bilgil CC BY 3.0 9 Writing Caitlin Regan CC BY 2.0 10 Latin Grammar Anthony Nelzin 13, 15, 29-34, 38 Noam Chomsky Fellowsisters CC BY-NC-SA 2.0