Lecture 06: Describing Language Syntax

 0    11 Fiche    up804653
скачать mp3 басу ойын өзіңді тексер
 
сұрақ English жауап English
what are regular grammars
оқуды бастаңыз
regular grammars (equivalently, regular expressions) are useful for defining languages’ lexical structure;
what re context-free grammars
оқуды бастаңыз
context-free grammars (CFG) for defining language syntax.
CFG is the ___ ___ used way to describe programming language.
оқуды бастаңыз
CFG is the most widely used way to describe programming language.
what is the formal definition for CFG
оқуды бастаңыз
a context-free grammar is a tuple G = (T, N, S,P)
if a context-free grammar is a tuple G = (T, N, S,P) what is T
оқуды бастаңыз
T is a finite nonempty set of terminal symbols, which consist of strings in the language (such as while), which refer to parts of the text of sentences in the language.
if a context-free grammar is a tuple G = (T, N, S,P) what is N
оқуды бастаңыз
N is a finite nonempty set of non-terminal symbols, disjoint from T. These refer to syntactic structures defined by other structures and rules (e.g., <exp>).
if a context-free grammar is a tuple G = (T, N, S,P) what is S
оқуды бастаңыз
S ∈ N (the start symbol),
if a context-free grammar is a tuple G = (T, N, S,P) what is P
оқуды бастаңыз
P is a set of (context-free) productions of the form A → α (reads A produces α) where A ∈ N and α ∈ (T ∪ N)∗.
What is the standard shorthand notation for context-free grammars (CFG)
оқуды бастаңыз
[1] The start symbol is that given on the left-hand-side of the first rule. [2] For each non-terminal symbol we use | to separate the alternative right-hand sides of the production rules.
write G2 in short hand G2 = (T, N, S, P) where T = {a, b}, N = {S, C} and P ={S →ε, S →C, S →aSa, S →bSb, C → a, C → b}.
оқуды бастаңыз
G2 can be written as follows: S → ε | C | aSa | bSb C → a | b
What does BNF stand for?
оқуды бастаңыз
Backus-Naur Form

Ұқсас флэшкарталарды қараңыз:

Lecture 01: Introduction to Programming Languages

Пікір қалдыру үшін жүйеге кіру керек.