|
@@ -1,25 +1,33 @@
|
|
|
# FLC - lesson 04
|
|
|
##### Luca Oddone Breveglieri
|
|
|
###### 12 october 2015
|
|
|
-## Grammars pt.I
|
|
|
+## Free Grammars pt.I
|
|
|
|
|
|
-#### Linguistic Abstraction //Optional
|
|
|
-Transforms the phrases of a real language and gives them an __abstract representation__
|
|
|
-> At the abstract level, the typical structures...
|
|
|
-
|
|
|
-#### Substitution operation
|
|
|
-Replaces the terminal characters of the source language with the phrases of the target language.
|
|
|
+### Grammars
|
|
|
+Are meant to overcome the limits of regexp
|
|
|
+Are composed by:
|
|
|
+- A __starting language__
|
|
|
+- A __set of rules__ which can be applied a finite number of times
|
|
|
|
|
|
-#### Nested Lists
|
|
|
-Lists may contain:
|
|
|
-- atomic objects
|
|
|
-- Other lists of *lower level*
|
|
|
+A language can be defined by rules that after multiple applications allow to generates all and only the phrases in the language
|
|
|
|
|
|
-## Grammars
|
|
|
-Are meant to overcome the limits of regexp
|
|
|
-Are composed by:
|
|
|
-- a startin language
|
|
|
-- a set of rules which can be applied a finite number of times.
|
|
|
+##### example:
|
|
|
+__Language__
|
|
|
+$$L=\{uu^R|u\in \{a,b\}^*\}=\{\varepsilon,aa,bb,abba,baab,...,abbbba,...\}$$
|
|
|
+__Grammar rules__
|
|
|
+$\text{frase}\rightarrow \varepsilon$ - The empty string is a valid phrase
|
|
|
+$\text{frase}\rightarrow a\;\text{frase}\;a$ - A phrase encloses in a, a it's a phrase
|
|
|
+$\text{frase}\rightarrow b\;\text{frase}\;b$ - A phrase encloses in b, b it's a phrase
|
|
|
+<!--*-->
|
|
|
+__Derivation chain__
|
|
|
+$$\text{frase}\Rightarrow a\;\text{frase}\;a$$
|
|
|
+Lista, frase are __non-terminal__ symbols
|
|
|
+##### example 2:
|
|
|
+The metalanguage of regular expressions
|
|
|
+__syntax__
|
|
|
+$1.\;espr \rightarrow\emptyset$
|
|
|
|
|
|
#### Context-free Grammars
|
|
|
Is a generalization of regexp
|
|
|
+
|
|
|
+###Reduction of the grammars
|