<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="https://ocw.cs.pub.ro/ppcarte/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://ocw.cs.pub.ro/ppcarte/feed.php">
        <title>books lfa</title>
        <description></description>
        <link>https://ocw.cs.pub.ro/ppcarte/</link>
        <image rdf:resource="https://ocw.cs.pub.ro/ppcarte/lib/tpl/bootstrap3/images/favicon.ico" />
       <dc:date>2026-04-25T14:45:14+03:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:2023&amp;rev=1728239085&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:2024&amp;rev=1759239459&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfg&amp;rev=1510748700&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfgpda&amp;rev=1541580906&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfl-prop&amp;rev=1517589195&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dfa-old&amp;rev=1603110745&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dfa&amp;rev=1603110992&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dictionaries&amp;rev=1632824482&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exam&amp;rev=1671096643&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:examen-optional&amp;rev=1610525360&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-1-solution&amp;rev=1610979867&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-1&amp;rev=1604567669&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-2-solution&amp;rev=1610990970&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-2&amp;rev=1607117946&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-3-solution&amp;rev=1611648038&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-3&amp;rev=1610700909&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-4-solution&amp;rev=1611824087&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-4&amp;rev=1611149964&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:flex&amp;rev=1510748583&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:introduction&amp;rev=1603110541&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:istoric-examene&amp;rev=1630511251&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:jflex&amp;rev=1539239216&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab&amp;rev=1538468457&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab01-python-intro&amp;rev=1633595568&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab02-dfa&amp;rev=1634130781&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab03-dfa-regexp&amp;rev=1634399839&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab03-lexers&amp;rev=1635151569&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab04-regexp-nfa&amp;rev=1635868932&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab05-nfa-python&amp;rev=1604833867&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab06-closure-properties&amp;rev=1668705371&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab06-mindfa&amp;rev=1636032852&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab07-the-pumping-lemma&amp;rev=1638785282&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab08-push-down-automata&amp;rev=1607112533&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab09-cfl&amp;rev=1638263146&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab09-grammars&amp;rev=1606483934&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab10-cfl-closures&amp;rev=1607411577&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab10-lexer&amp;rev=1639492267&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab11-cfl-pumping-lemma&amp;rev=1607890964&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab11-cfprop&amp;rev=1673539240&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab12&amp;rev=1610355266&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab13&amp;rev=1610919676&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab14&amp;rev=1611508346&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:languages&amp;rev=1532077248&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:nfa-old&amp;rev=1603111083&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:nfa&amp;rev=1603111132&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:parser&amp;rev=1517589230&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:pda&amp;rev=1510748797&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:prop&amp;rev=1572523006&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:reg&amp;rev=1532346470&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:team&amp;rev=1664880094&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://ocw.cs.pub.ro/ppcarte/lib/tpl/bootstrap3/images/favicon.ico">
        <title>books</title>
        <link>https://ocw.cs.pub.ro/ppcarte/</link>
        <url>https://ocw.cs.pub.ro/ppcarte/lib/tpl/bootstrap3/images/favicon.ico</url>
    </image>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:2023&amp;rev=1728239085&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-10-06T21:24:45+03:00</dc:date>
        <title>lfa:2023</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:2023&amp;rev=1728239085&amp;do=diff</link>
        <description>Structura curs universitar LFA 2022-2023

	*   Echipa 
	*   Regulament 
	*  Lectures
		*   1. ???

	*  Labs
		*   1. Programming introduction - Python
		*   2. DFA and Regex intro
		*   3. Regex practice
		*   4. Regex to DFA
		*   5. DFA minimisation
		*   6. DFA to Regex
		*   7. Closure properties
		*   8. Pumping lemma
		*   9. Context-Free Languages
		*   10. CFG to PDA; Lexers

	*   Proiect 
	*   Coding Style 
	*   Bonus</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:2024&amp;rev=1759239459&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-09-30T16:37:39+03:00</dc:date>
        <title>lfa:2024</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:2024&amp;rev=1759239459&amp;do=diff</link>
        <description>Structura curs universitar LFA 2024-2025

	*   1. DFA intro
		*   2. Programming introduction - Python
		*   3. Regular Expressions
		*   4. Regex Representation in Python
		*   5. Regex to NFA to DFA conversions
		*   6. DFA Minimisation
		*   7. Closure properties
		*   8. Pumping lemma
		*   9. Push Down Automata
		*   10. Context-Free Grammars
		*   11. Closure properties for Context-Free Languages</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfg&amp;rev=1510748700&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-11-15T14:25:00+03:00</dc:date>
        <title>lfa:cfg</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfg&amp;rev=1510748700&amp;do=diff</link>
        <description>Context-Free Grammars

Motivation

Regular expressions are insufficient in describing the structure of complicated languages (e.g. programming languages). We recall our previously-used example: simple arithmetic expressions with parentheses. 


&lt;expr&gt; ::= &lt;atom&gt; | &lt;expr&gt; + &lt;expr&gt; | (&lt;expr&gt;)

$ G=(V,\Sigma,R,S)$$ V$$ \Sigma\subseteq V$$ R$$ (V\setminus\Sigma)\times V^*$$ V\setminus\Sigma$$ V^*$$ V$$ R$$ S\in V\setminus\Sigma$$ G$$ V=\{S\}$$ \Sigma=\{a,b\}$$ R=\{S\rightarrow aSb, S\rightarrow \eps…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfgpda&amp;rev=1541580906&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-11-07T10:55:06+03:00</dc:date>
        <title>lfa:cfgpda</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfgpda&amp;rev=1541580906&amp;do=diff</link>
        <description>CFG - PDA equivalence

We prove that languages generated by Context-Free Grammar coincide with those accepted by PDAs.
The proof is done in two steps. 

CFG to PDA

Given a Context-Free grammar $ G=(V,\Sigma,R,S)$ , we build a PDA $ M=(K,\Sigma,\Gamma,\Delta,q_0,Z_0,F)$  which accepts precisely $ L(G)$ . The main idea is:$ \alpha A \beta \Rightarrow_G \alpha \gamma \beta$$ G$$ M$$ S\rightarrow AB$$ A\rightarrow aB \mid bA$$ B\rightarrow bB\mid \epsilon$$ S\Rightarrow AB \Rightarrow bAB \Rightarr…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfl-prop&amp;rev=1517589195&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-02-02T18:33:15+03:00</dc:date>
        <title>lfa:cfl-prop</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:cfl-prop&amp;rev=1517589195&amp;do=diff</link>
        <description>Properties of Context-Free Languages

Chomsky Normal Form

Definition (CNF): 

$ G$Chomsky Normal Formeach

	*  $ A\rightarrow BC$  where $ A,B,C$  are non-terminals 
	*  $ A\rightarrow a$  where $ A$  is a non-terminal and $ a$  is a terminal

useless

We also prove that:

Proposition (CNF): 

$ L$$ L\neq \emptyset$$ \epsilon\not\in L$$ G$Chomsky Normal Form$ L(G)=L$$ G$$ A\rightarrow B_1 \ldots a\ldots B_n$$ B_i$$ a$$ A\rightarrow B_1\ldots C\ldots B_n$$ C\rightarrow a$$ A\rightarrow B_1 \ldot…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dfa-old&amp;rev=1603110745&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-10-19T15:32:25+03:00</dc:date>
        <title>lfa:dfa-old</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dfa-old&amp;rev=1603110745&amp;do=diff</link>
        <description>Deterministic automata

Motivation

In the last lecture, we have shown that, for each regular expression $ e$ , we can construct an NFA $ M$ , such that $ L(e) = L(M)$ .

While NFAs are a computational instrument for establishing acceptance, they are not an ideal one. Nondeterminism is difficult to translate per. se. in a programming language. It is also quite inefficient. We illustrate this via our previous example, below. Recall our NFA representation in Haskell:$ w$$ nfa$$ w\in L(nfa)$$ s'$$ …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dfa&amp;rev=1603110992&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-10-19T15:36:32+03:00</dc:date>
        <title>lfa:dfa</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dfa&amp;rev=1603110992&amp;do=diff</link>
        <description>Deterministic automata

Definition (DFA): 

Deterministic Finite Automata$ (K,\Sigma,\delta,q_0,F)$$ K$$ \Sigma$$ \Delta : K \times \Sigma \rightarrow K$total

Definition (Configuration): 

configuration$ K\times\Sigma^*$

Definition (One-step move): 

$ \vdash_M \subseteq (K\times \Sigma^*) \times (K\times \Sigma^*)$one-step

	*  $ (q,w) \vdash_M (q',w')$  iff $ w=cw'$  for some symbol $ c$  of the alphabet, and $ \delta(q,c)=q'$ 

$ \vdash_M^*$reflexive and transitive closure$ \vdash_M$$ (q,w)…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dictionaries&amp;rev=1632824482&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-09-28T13:21:22+03:00</dc:date>
        <title>lfa:dictionaries</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:dictionaries&amp;rev=1632824482&amp;do=diff</link>
        <description>Dictionaries and hashing

A review over hashtables

Python dictionaries are hashtable implementations. In short, the instruction:


val = d[x]


will:

	*  apply the a function $ hash$  on object x, to obtain a bucket $ b$ , ($ hash(x)=b$ )
	*  buckets are just collections of key-value pairs (often implemented as arrays). Next we search (in linear time) for key $ b$$ hash$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exam&amp;rev=1671096643&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-12-15T11:30:43+03:00</dc:date>
        <title>lfa:exam</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exam&amp;rev=1671096643&amp;do=diff</link>
        <description>Examen LFA 2021-2022

TBA

Examen LFA 2020-2021

Examenul la cursul de Limbaje Formale si Automate valorează 5 puncte. Pentru promovarea examenului este necesar 50% din punctaj (2.5 puncte).
Cele 5 puncte vor fi obținute în cadrul a doua probe:

	*</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:examen-optional&amp;rev=1610525360&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-13T10:09:20+03:00</dc:date>
        <title>lfa:examen-optional</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:examen-optional&amp;rev=1610525360&amp;do=diff</link>
        <description>Examen optional 2020-2021

Miercuri 27 ianuarie, de la ora 10:00, in cadrul ultimului curs de LFA, vom organiza un examen-interviu (oral) optional, la care studentii se pot inscrie pentru a degreva examenul oral din sesiune. Cu acordul studentilor, vom inregistra o parte din interviuri, astfel incat procedura sa poata fi transparenta pentru toti studentii. Cateva observatii vizavi de acest examen:</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-1-solution&amp;rev=1610979867&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-18T16:24:27+03:00</dc:date>
        <title>lfa:exercise-sheet-1-solution</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-1-solution&amp;rev=1610979867&amp;do=diff</link>
        <description>Exercise sheet I solution
$ \{a, b\}$

1. Definiți câte un AFD pentru limbajul șirurilor care conțin:

1.a.  cel puțin doi $ b$

1.b.  exact doi $ b$

1.c.  cel mult doi $ b$

Solutie:



2. Scrieți un AFD peste alfabetul $ \{0, 1\}$, care recunoaște reprezentări binare ale numerelor divizibile cu 5.
E.g. 0, 101, 1010, 1111, $ w=1010$$ 5k$$ 5k+1$$ 5k+2$$ 5k+3$$ 5k+4$$ 5k$$ k$$ q$$ n = 5k+r$$ b$$ 2*n + b$$ 10k + 2r + b$$ r$$ (2r + b)$$ 5$$ \vdots 1$$ \vdots 2$$ \varepsilon$$ \varepsilon$$ N=(K,\S…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-1&amp;rev=1604567669&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-11-05T11:14:29+03:00</dc:date>
        <title>lfa:exercise-sheet-1</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-1&amp;rev=1604567669&amp;do=diff</link>
        <description>Exercise sheet I
$ \{a, b\}$

1. Definiți câte un AFD pentru limbajul șirurilor care conțin:

	*   cel puțin doi $ b$
	*   exact doi $ b$
	*   cel mult doi $ b$

2. Scrieți un AFD peste alfabetul $ \{0, 1\}$, care recunoaște reprezentări binare ale numerelor divizibile cu 5.
E.g. 0, 101, 1010, 1111, $ \varepsilon$$ \varepsilon$$ |E|$$ E$$ \varepsilon$$ \emptyset$$ \cup$$ *$$ E$$\begin{equation} |E| \ge \max_{w \in L(E)}{|w|}\end{equation}</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-2-solution&amp;rev=1610990970&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-18T19:29:30+03:00</dc:date>
        <title>lfa:exercise-sheet-2-solution</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-2-solution&amp;rev=1610990970&amp;do=diff</link>
        <description>Solutii pentru exercise sheet 2

1. Fie $ fst(L) = \{ w \in \Sigma^\star \mid \exists x \in \Sigma^\star, a.î. wx \in L\ și\ |x| = |w| \}$. Arătați că $ fst$ este o proprietate de închidere pentru limbajele regulate.

Solutie:

Pentru a intelege mai bine $ fst(L)$ , il putem aplica pe un limbaj finit, dar si pe unul infinit:

	*  $ fst(\{A,BAAB,AB\} = \{BA,A\}$ 
	*  $ fst(L(A^*B^+)) = \{B,A,AA,BB,AB, \ldots \}$ 

Conditia $ \mid x\mid = \mid w\mid$  ne obliga sa identificam $ L$$ L(A^*B^+)$$ L(B…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-2&amp;rev=1607117946&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-12-04T23:39:06+03:00</dc:date>
        <title>lfa:exercise-sheet-2</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-2&amp;rev=1607117946&amp;do=diff</link>
        <description>1. Fie $ fst(L) = \{ w \in \Sigma^\star \mid \exists x \in \Sigma^\star, a.î. wx \in L\ și\ |x| = |w| \}$. Arătați că $ fst$ este o proprietate de închidere pentru limbajele regulate.

2. Fie $ L_3 = \{ w \in \{0, 1\}^* \mid \#_{01}(w) = \#_{10}(w) \}$ (i.e. cuvintele conțin același număr de secvențe “01” și “10”). Demonstrați că $ L_3$ este regulat.

3. Demonstrați că $ L = \{ a^nb^mc^{n-m} \mid n \ge m \ge 0 \}$ nu este un limbaj regulat, fără a folosi izomorfisme.$ L$$ L_1$$ L_2$$ L_1 \cap L_…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-3-solution&amp;rev=1611648038&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-26T10:00:38+03:00</dc:date>
        <title>lfa:exercise-sheet-3-solution</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-3-solution&amp;rev=1611648038&amp;do=diff</link>
        <description>Folosiți lema de pompare pentru a arăta că următoarele limbaje nu sunt independente de context:

1. $ L_1 = \{ 0^{2^n} \mid n \ge 0 \}$

Solutie:

Alegem (tentativ) $ w_n = 0^{2^n}$ . Conform lemei de pompare pentru LIC, cuvantul $ w_n$  este de forma $ xyzuv$ , unde $ \mid yzu \mid \leq n$  si $ yu \neq \epsilon$ . Cautam o valoare pentru $ i$  astfel incat $ xy^izu^iv \not\in L_1$$ \#\alpha$$ \alpha$$ \#x + i\#y + \#z + i\#u + \#v \neq 2^k$$ k$$ i&gt;0$$ \#x + i\#y + \#z + i\#u + \#v &lt; 2^{n+1}$$ …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-3&amp;rev=1610700909&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-15T10:55:09+03:00</dc:date>
        <title>lfa:exercise-sheet-3</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-3&amp;rev=1610700909&amp;do=diff</link>
        <description>Folosiți lema de pompare pentru a arăta că următoarele limbaje nu sunt independente de context:

1. $ L_1 = \{ 0^{2^n} \mid n \ge 0 \}$

2. $ L_2 = \{ a^nb^mc^nd^m \mid n, m \ge 0 \}$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-4-solution&amp;rev=1611824087&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-28T10:54:47+03:00</dc:date>
        <title>lfa:exercise-sheet-4-solution</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-4-solution&amp;rev=1611824087&amp;do=diff</link>
        <description>1. Scrieți o MT care să decidă $ L_1 = \{ 0^{2^n} \mid n \ge 0 \}$

Mașina funcționează astfel:

	*  merge de la stânga la dreapta marcând cu X zerouri din doi în doi
	*  dacă a găsit un singur 0 acceptă
	*  dacă a găsit un număr impar de 0 respinge
	*  întoarce capul de citire pe primul simbol și repetă procesul$ q_{reject}$$ q_{accept}$$ L_2 = \{ a^nb^mc^nd^m \mid n, m \ge 0 \}$$ q_{reject}$$ q_{accept}$$ q_{accept}$$ q_{accept}$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-4&amp;rev=1611149964&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-20T15:39:24+03:00</dc:date>
        <title>lfa:exercise-sheet-4</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:exercise-sheet-4&amp;rev=1611149964&amp;do=diff</link>
        <description>Scrieți câte o mașină Turing (tabel de tranziție, graf sau fișier input pentru un simulator) care să decidă limbajele:

1. $ L_1 = \{ 0^{2^n} \mid n \ge 0 \}$

2. $ L_2 = \{ a^nb^mc^nd^m \mid n, m \ge 0 \}$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:flex&amp;rev=1510748583&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-11-15T14:23:03+03:00</dc:date>
        <title>lfa:flex</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:flex&amp;rev=1510748583&amp;do=diff</link>
        <description>An introduction to Flex

Compiling Flex

Consider the following Flex application, which counts newline, word and byte counts, in a fashion similar to the wc (word count) Unix tool.


%option noyywrap 

%{

#include &lt;unistd.h&gt;

int chars = 0;
int words = 0;
int lines = 0;

%}

%%

[a-zA-Z]+ { words++; chars += strlen(yytext); }
\n { chars++; lines++; }
. { chars++; }

%%

int main(int argc, char **argv)
{
 yylex();
 printf(&quot;%8d%8d%8d\n&quot;, lines, words, chars);
}</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:introduction&amp;rev=1603110541&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-10-19T15:29:01+03:00</dc:date>
        <title>lfa:introduction</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:introduction&amp;rev=1603110541&amp;do=diff</link>
        <description>Introduction to Formal Languages and Automata

Preliminaries

Formal Languages are a branch of theoretical Computer Science which has applications in numerous areas. Some of them are:

	*  compilers and compiler design
	*  complexity theory 
	*  program verification</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:istoric-examene&amp;rev=1630511251&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-09-01T18:47:31+03:00</dc:date>
        <title>lfa:istoric-examene</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:istoric-examene&amp;rev=1630511251&amp;do=diff</link>
        <description>Examene LFA

Examen restanta LFA 10 sept 2021

1. Selectati din lista de mai jos acele expresii regulate care genereaza acelasi limbaj ca AFN-ul din diagrama.


      0
  fin---&gt;
    &lt;---
   U  1 U
   0    1


	*  1*10*0    (Fals)
	*  (0 U 1)*  (Adevarat)$ L = \{0^{n}1^{n}0^n \mid n &gt; 0\}$$ L$$ L \dot L(0^*)$$ L(0^*)\dot L$$ \{w^Rw \mid w \in \{0,1\}^*\}$$ \{0^n1^{m+k}0^p \mid m &gt; n, k &gt; p \}$$ L=\{a^nb^m \mid n &gt; m &gt; 0\}$$ S \leftarrow ABA, A\leftarrow 1A \mid \epsilon, B\leftarrow 1B \mid 1$$ …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:jflex&amp;rev=1539239216&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-10-11T09:26:56+03:00</dc:date>
        <title>lfa:jflex</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:jflex&amp;rev=1539239216&amp;do=diff</link>
        <description>An introduction to JFlex

What is missing in the Haskell analyser?

Our Haskell analyser is generic (independent of the language being scanned), however it lacks certain key features which are key for production development:

	*  the regular expressions are defined as part of the code, together with the functions</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab&amp;rev=1538468457&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-10-02T11:20:57+03:00</dc:date>
        <title>lfa:lab</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab&amp;rev=1538468457&amp;do=diff</link>
        <description>Lab

Lab-01 - Expresii regulate

Key insights:

	*  more languages than regular expressions
	*  we do not know how to write regular expressions for some languages (as a direct consequence of the above)
	*  reg.exps. are unambiguous and FINITE language representations$ \Sigma=\{0, 1\}$$ L=\{011\}$$ E=011$$ E=((01)1)$$ \Sigma=\{a, b\}$$ L=\{a, b\}$$ E=a \cup b$$ E=(a \cup b)$$ \Sigma=\{0, 1\}$$ L=\{e, 0, 1, 00, 01, 10, 11, 000, \ldots\}$$ E=(0 \cup 1)^{*}$$ \Sigma=\{0, 1\}$$ L=\{010010101000010, 0…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab01-python-intro&amp;rev=1633595568&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-07T11:32:48+03:00</dc:date>
        <title>lfa:lab01-python-intro</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab01-python-intro&amp;rev=1633595568&amp;do=diff</link>
        <description>1. Introduction to Python

Python3 is a multi-paradigm language, that combines the imperative style with the functional style. It also supports Object-Oriented programming, albeit in a limited way. 

Python3 offers a few programming constructs that:</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab02-dfa&amp;rev=1634130781&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-13T16:13:01+03:00</dc:date>
        <title>lfa:lab02-dfa</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab02-dfa&amp;rev=1634130781&amp;do=diff</link>
        <description>2. Deterministic finite automata

Classes in Python

Python supports a limited version of Object-Oriented programming, which includes class definitions and inheritance. The concept of interface and interface implementation is absent. Hence, when inheriting a function, it is the job of the programmer to make sure a method is overloaded correctly (otherwise it is just another definition of the class).$ L=\{w \in \{0,1\}^* \text{ | w contains an odd number of 1s} \} $</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab03-dfa-regexp&amp;rev=1634399839&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-16T18:57:19+03:00</dc:date>
        <title>lfa:lab03-dfa-regexp</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab03-dfa-regexp&amp;rev=1634399839&amp;do=diff</link>
        <description>4. Regular expressions

4.1. Formation rules (concatenation, reunion, Kleene star)

4.1.1.

$ A=\{ 0^{2k} \mid k \geq 1 \}$

$ B = \{0, \epsilon \}$


$ AB = ? $



4.1.2.
$ A = \{ 0^n 1^n \mid n \geq 1 \}$


$ B = \{ 1^n \mid n \geq 1 \} $


$ AB = ? $ 
$ BA = ? $

4.1.3.
$ A = \emptyset $


$ B = \{ 1^n \mid n \geq 1 \} $


$ AB = ? $


$ A^* = ? $


$ B^* = ? $



4.2. Writing Regular Expressions

4.2.1. Write a regular expression for the language of arithmetic expressions containing +, * and…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab03-lexers&amp;rev=1635151569&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-10-25T11:46:09+03:00</dc:date>
        <title>lfa:lab03-lexers</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab03-lexers&amp;rev=1635151569&amp;do=diff</link>
        <description>3. Lexers

3.1. Longest match

Lexers use specs to split a string into lexemes (of a given type, called token). In this lab, the specs will be DFAs.

A lexer runs DFAs on a string, searching for the longest prefix which is accepted by at least one of the DFAs. $ A_1$$ A_1$$ w$$ A_2$$ A_3$$ A_4$$ A_5$$ w$$ A$$ B$$ w$$ A$$ B$$ B$$ A$$ A$$ B$$ A_3$$ A_4$$ A_5$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab04-regexp-nfa&amp;rev=1635868932&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-11-02T18:02:12+03:00</dc:date>
        <title>lfa:lab04-regexp-nfa</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab04-regexp-nfa&amp;rev=1635868932&amp;do=diff</link>
        <description>5. Regex to DFA conversion

5.1. Nondeterministic Finite Automata

5.1.1. Consider the following NFA:



What are all reachable configurations from (0,abba) ?

5.1.2. What is the accepted language of the previous NFA? 

5.1.3. Write an NFA without $ \varepsilon$-transitions, which accepts the language $ L = \{abc,abd,aacd\}$$ \Sigma = \{a,b,c,d\}$$ (0,abbabbb)$$ (1 \cup \varepsilon)(00^*1)^*0^*$$ \varepsilon$$ E(q)$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab05-nfa-python&amp;rev=1604833867&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-11-08T13:11:07+03:00</dc:date>
        <title>lfa:lab05-nfa-python</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab05-nfa-python&amp;rev=1604833867&amp;do=diff</link>
        <description>NFA Python Implementation

Consider the following encoding of an NFA:


   &lt;number_of_states&gt;
   &lt;list_of_chars_in_alphabet&gt;
   &lt;list_of_final_states&gt;
   &lt;state&gt; &lt;symbol&gt; &lt;list_of_states&gt;


Example:


9
a b
4
0 EPS 1
0 a 5
0 b 0
1 EPS 2
1 b 3 5
2 EPS 4
2 a 2 3
3 a 3
3 b 3
4 EPS 4 7 8
5 a 6
5 b 5
6 EPS 7
6 a 6
7 EPS 6
7 b 4

$ k &gt; 0 $</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab06-closure-properties&amp;rev=1668705371&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-11-17T19:16:11+03:00</dc:date>
        <title>lfa:lab06-closure-properties</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab06-closure-properties&amp;rev=1668705371&amp;do=diff</link>
        <description>7. Closure properties

7.1. Show that $(10 \cup 0)^*(1 \cup \epsilon)$  and $(1 \cup \epsilon)(00^*1)^*0^*$ are equivalent regular expressions. Are there several strategies?



	*  You can use an existing minimisation algorithm to find the minimal DFAs. Then, label each state from each DFA from 0 to |K|. Fix an ordering of the symbols of the alphabet. Sort the transitions by symbol. Make a textual representation of each DFA which includes the number of states and the sorted transition function. …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab06-mindfa&amp;rev=1636032852&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-11-04T15:34:12+03:00</dc:date>
        <title>lfa:lab06-mindfa</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab06-mindfa&amp;rev=1636032852&amp;do=diff</link>
        <description>6. Minimal DFAs

6.1. Equivalence between states

Consider the following DFA: 

----------



----------

6.1.1. Identify a pair of states which are indistinguishable.

6.1.2. Identify a pair of final or non-final states which are distinguishable. The pair must be distinguished by a word different from the empty word.$ (1\cup\epsilon)(00^*1)^*0^*$$ (10\cup 0)^*(01 \cup 1)^*(0 \cup \epsilon)$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab07-the-pumping-lemma&amp;rev=1638785282&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-12-06T12:08:02+03:00</dc:date>
        <title>lfa:lab07-the-pumping-lemma</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab07-the-pumping-lemma&amp;rev=1638785282&amp;do=diff</link>
        <description>8. Proving languages are not regular

8.1. The pumping lemma

8.1.1. Show that the pumping lemma holds for finite languages.

8.1.2.* Find a language which is not regular for which the pumping lemma holds.

8.2. Languages which are not regular

Show that each of the languages from the list below is not regular.$  L = \{ \: A^n B^m \: | \: 0 \leq n \leq m \: \} $$  L = \{ \: w \in \{A,B\}^* \: | \: \#A(w) = \#B(w) \: \} $$ L = \{(01)^n(10)^n \mid n &gt; 0 \} $$  L = \{ \: w \in \{A,B\}^* \: | \: \te…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab08-push-down-automata&amp;rev=1607112533&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-12-04T22:08:53+03:00</dc:date>
        <title>lfa:lab08-push-down-automata</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab08-push-down-automata&amp;rev=1607112533&amp;do=diff</link>
        <description>Push down automata

Exercise 1. Write PDAs for the following languages:

1.1. $ L = \{\: w \in \{A,B\}^* \ | \:w \text{ is a palindrome}\} $

1.2. $ L = \{\: w \in \{A,B\}^* \ | \: \text{#}A(w) \neq \: \text{#}B(w) \} $

1.3. $ L = \{ A^{m} B^{m+n} C^{n} \ | \: n, m \geq 0 \} $

1.4. $ L = \{ A^{n}B^{n}C^{m}D^{m} | \: \ n,m \geq 0 \}  \cup  \{ A^nB^mC^mD^n | \: \ n,m \geq 0 \} $

1.5. $ L = \{ A^{i}B^{j}C^{k} | \: \text{ i=j or j=k} \} $

Exercise 2. Acceptance by empty stack.

Consider the foll…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab09-cfl&amp;rev=1638263146&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-11-30T11:05:46+03:00</dc:date>
        <title>lfa:lab09-cfl</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab09-cfl&amp;rev=1638263146&amp;do=diff</link>
        <description>9. Context-Free Languages

9.1. Accepting and generating a CF language

Write a PDA as well as a CF grammar for the following languages. Specify - for each PDA, the way it accepts (by empty-stack or by final state). For each grammar, make sure it is not ambiguous. (Start with any CF grammar that accepts L. Then write another non-ambiguous grammar for the same language).$ L = \{\: w \in \{A,B\}^* \ | \:w \text{ is a palindrome}\} $$ L = \{ A^{m} B^{m+n} C^{n} \ | \: n, m \geq 0 \} $$ L = \{w \in …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab09-grammars&amp;rev=1606483934&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-11-27T15:32:14+03:00</dc:date>
        <title>lfa:lab09-grammars</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab09-grammars&amp;rev=1606483934&amp;do=diff</link>
        <description>Grammars

Writing Grammars

1. Write grammars for the following languages:

1.1. $ L = \{a^{m}b^{m + n}c^{n} | n, m \geq 0 \} $ 

1.2. $ L = \{a^ib^jc^k | i = j \lor j = k \} $ 

1.3. $ L = \{w \in \{a, b\}^* | \#_a(w) \neq \#_b(w) \} $

Ambiguity

2. Which of the following grammars are ambiguous? Justify each answer. Modify the grammar to remove ambiguity, wherever the case.

2.1.

$ S \leftarrow aA | A $ 

$ A \leftarrow aA | B $$ B \leftarrow bB | \epsilon $$ S \leftarrow AS | \epsilon $$ A \…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab10-cfl-closures&amp;rev=1607411577&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-12-08T09:12:57+03:00</dc:date>
        <title>lfa:lab10-cfl-closures</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab10-cfl-closures&amp;rev=1607411577&amp;do=diff</link>
        <description>Context Free Languages

Context-Free Grammar to Pushdown Automata

 1. Consider the following CFG:

$ S \leftarrow X\ |\ Y $ 

$ X \leftarrow YXY\ |\ 0X\ |\ 0 $ 

$ Y \leftarrow YY\ |\ 1\ |\ \epsilon $

1.1 Write a PDA which accepts L(G)

1.2 Write a sequence of derivations which yeilds $ S\ \Rightarrow\ 110X1Y $ . What is it's corresponding sequence of transitions in the PDA?$ (p, 111100, XZ0) \mapsto^*  (p, e, Z0) $$ \alpha $$ \alpha_1 \ldots \alpha_n $$ L = \{a^{n}b^{2n}c^{2m}d^{m}\ |\ n, m \…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab10-lexer&amp;rev=1639492267&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-12-14T16:31:07+03:00</dc:date>
        <title>lfa:lab10-lexer</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab10-lexer&amp;rev=1639492267&amp;do=diff</link>
        <description>10. Writing a parser for a CF language

10.1. A basic functional structure for a parser

Consider the following language encoding expressions:

	*  $ S \leftarrow M \mid M + S$ 
	*  $ M \leftarrow A \mid A * M$ 
	*  $ A \leftarrow 0 \mid 1 \mid (S)$ 

10.1.1. Implement an AST for expressions.

	*  A parser is a function which takes a string and has</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab11-cfl-pumping-lemma&amp;rev=1607890964&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-12-13T22:22:44+03:00</dc:date>
        <title>lfa:lab11-cfl-pumping-lemma</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab11-cfl-pumping-lemma&amp;rev=1607890964&amp;do=diff</link>
        <description>Context Free Languages

Pumping Lemma

1. Pumping Lemma

Prove that the following languages are not context-free.

1.1. $ L=\{a^nb^{2n}c^n \ | \ n \geq 0\} $

1.2. $ L=\{a^n \ | \ n \text{ is a prime number}\} $

1.3. $ L=\{ww \ | \ w \in \{0,1\}^*\} $

2. Simple parser based on PDAs.

2.1. Write a PDA which accepts the language described below:


&lt;expr&gt; ::= &lt;expr&gt; + &lt;expr&gt; | &lt;expr&gt; * &lt;expr&gt; | (&lt;expr&gt;) | &lt;number&gt;
&lt;number&gt; ::= [0-9]+

$\texttt{Expr}$$\texttt{Plus}$$\texttt{Mult}$$\texttt{Par}$$\t…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab11-cfprop&amp;rev=1673539240&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-01-12T18:00:40+03:00</dc:date>
        <title>lfa:lab11-cfprop</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab11-cfprop&amp;rev=1673539240&amp;do=diff</link>
        <description>L11. Laborator recapitulativ

11.1. Fie $ L$  un limbaj descris de o expresie regulata ce nu contine operatorul Kleene Star. Care afirmatie este adevarata?

	*  $ L$  este regulat
	*  $ L$  nu este regulat
	*  $ L$  este independent de context
	*  $ L$  este infinit
	* $ \overline{L}$$ \mathcal{L}$$ \epsilon$$ \mathcal{L}\subsetneq LR$$ LR$$ A$$ E_1$$ \overline{L(A)}$$ E_2$$ L(A)$$ L(E_1E_2) = \emptyset$$ E_1$$ E_2$$ L(E_1 \cup E_2) = \Sigma^*$$ L(E_1) \subsetneq L(E_2)$$ w = c_1c_2\ldots c_n$$ …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab12&amp;rev=1610355266&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-11T10:54:26+03:00</dc:date>
        <title>lfa:lab12</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab12&amp;rev=1610355266&amp;do=diff</link>
        <description>Mașina Turing



&lt;http://www.jflap.org/&gt;

&lt;https://turingmachinesimulator.com/&gt;



1. Scrieți o Mașină Turing care primește ca input un șir binar arbitrar și îl mută mai la dreapta cu două poziții.

101110110100001##...



##101110110100001##...

2. Scrieți o Mașină Turing care incrementează la nesfârșit un contor binar. Cel mai semnificativ bit este cel mai din $ L = \{ w\_w \mid w \in \{0, 1\}^* \}$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab13&amp;rev=1610919676&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-17T23:41:16+03:00</dc:date>
        <title>lfa:lab13</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab13&amp;rev=1610919676&amp;do=diff</link>
        <description>Limbaje decidabile

1. Descrieți un algoritm care decide limbajul $ GEN_{finite} = \{ \langle \mathcal{G} \rangle \mid \mathcal{G} \text{ e GIC} \land L(\mathcal{G}) \text{ finit} \}$

2. Demonstrați că mulțimea limbajelor decidabile e închisă în raport cu următoarele operații:

	*  complement
	*  reuniune
	*  interesecție
	*  concatenare
	*  star
“”“</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab14&amp;rev=1611508346&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-01-24T19:12:26+03:00</dc:date>
        <title>lfa:lab14</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:lab14&amp;rev=1611508346&amp;do=diff</link>
        <description>Limbaje nedecidabile

1. Demonstrați că limbajul $ REG_{TM} = \{ &lt;M&gt; \mid L(M) \text{ este regulat } \}$ este nedecidabil.

2. Demonstrați că limbajul $ R_{TM} = \{ &lt;M&gt; \mid w \in L(M) \iff w^R \in L(M) \}$ este nedecidabil ($ w^R$ este inversul cuvântului $ w$).

3. Demonstrați că relația $ \leq_M$ e tranzitivă (i.e. $ A \leq_M B$ și $ B \leq_M C \implies A \leq_M C$).

4. Demonstrați că limbajul $ EMPTY_{TM} = \{ &lt;M&gt; \mid L(M) = \emptyset \} $ este nedecidabil.$ HALT$$ ALL_{TM} = \{ &lt;M&gt; \mid L…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:languages&amp;rev=1532077248&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-07-20T12:00:48+03:00</dc:date>
        <title>lfa:languages</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:languages&amp;rev=1532077248&amp;do=diff</link>
        <description>Languages and Regular Expressions

Motivation

Regular expressions are a means for defining tokens (roles) during the lexical phase. Token definition is instrumental in the development of parser generators (e.g. ANTLR).

Let $ \Sigma$  be an alphabet, i.e. a finite set whose elements we call $ \{a,b,c\}$$ \Sigma$$ \emptyset$$ c\in\Sigma$$ e$$ e'$$ (ee')$$ ee$$ (e\cup e')$$ e$$ (e)^*$$ (A\cup B)(a\cup b)^*(0 \cup 1)^*$$ (a \cup b)^*$$ (0 \cup 1)^*$$ 01^*\cup 1$$ union(kleene(concat(0,1)),1)$$ (01…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:nfa-old&amp;rev=1603111083&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-10-19T15:38:03+03:00</dc:date>
        <title>lfa:nfa-old</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:nfa-old&amp;rev=1603111083&amp;do=diff</link>
        <description>Nondeterministic Automata

Motivation

In the previous lecture we have investigated the semantics of regular expressions and saw that how we can determine the language accepted by, e.g. $ (A\cup B)(a\cup b)*(0 \cup 1)*$ . However, it is not straightforward to compute whether a given word $ w$$ L(e)$$ w \in L((A\cup B)(a\cup b)*(0 \cup 1)*)$$ 0\in set$$ 1\in set$$ 2\in set$$ 3\in set$$ Q_0$$ Q'$$ Q''$$ Q$$ Q'$$ M=(K,\Sigma,\Delta,q_0,F)$$ K$$ \Sigma$$ \Delta$$ K \times \Sigma^* \times K$$ q_0\in …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:nfa&amp;rev=1603111132&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-10-19T15:38:52+03:00</dc:date>
        <title>lfa:nfa</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:nfa&amp;rev=1603111132&amp;do=diff</link>
        <description>Nondeterministic Automata

Motivation

In the previous lecture we have investigated the semantics of regular expressions and saw that how we can determine the language accepted by, e.g. $ (A\cup B)(a\cup b)*(0 \cup 1)*$ . However, it is not straightforward to compute whether a given word $ w$$ L(e)$$ M=(K,\Sigma,\Delta,q_0,F)$$ K$$ \Sigma$$ \Delta$$ K \times \Sigma^* \times K$$ q_0\in K$$ F\subseteq K$$ K=\{q_0,q_1,q_2\}$$ \Sigma=\{0,1\}$$ \Delta=\{(q_0,0,q_0),(q_0,1,q_0),(q_0,0,q_1),(q_1,1,q_2)…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:parser&amp;rev=1517589230&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-02-02T18:33:50+03:00</dc:date>
        <title>lfa:parser</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:parser&amp;rev=1517589230&amp;do=diff</link>
        <description>Writing parsers with ANTLR

What is ANTLR (4.0)

ANTLR (ANother Tool for Language Recognition) is widely used parser-generator. The input for ANTLR is a grammar. The output is a set of files implementing a:

	*  lexer
	*  a parser together with a walker</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:pda&amp;rev=1510748797&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-11-15T14:26:37+03:00</dc:date>
        <title>lfa:pda</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:pda&amp;rev=1510748797&amp;do=diff</link>
        <description>Push-down Automata

Introduction

Push-down automata (or PDAs) are acceptors of Context-Free languages. Informally, a push-down automata is equipped with a simplistic type of memory - a stack. Thus, a PDA is able to push or pop symbols, however it is unable to directly $ M=(K,\Sigma,\Gamma,\Delta,q_0,Z_0,F)$$ K$$ \Sigma$$ \Gamma$$ \Sigma$$ \Delta\subseteq K\times \Sigma^*\times \Gamma^*\times K\times\Gamma^*$$ (q,c,\gamma,q',\gamma')\in\Delta$$ q$$ c$$ \gamma$$ q'$$ \gamma'$$ \gamma=a$$ a$$ \gam…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:prop&amp;rev=1572523006&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-10-31T13:56:46+03:00</dc:date>
        <title>lfa:prop</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:prop&amp;rev=1572523006&amp;do=diff</link>
        <description>Pumping Lemma

Motivation

Consider the language defined via BNF (Bakus-Naur Form) as follows:

	* &lt;expr&gt; ::= &lt;expr&gt; + &lt;expr&gt; | (&lt;expr&gt; + &lt;expr&gt;) | &lt;atom&gt;

which describes simple arithmetic expressions with parentheses. Let us ignore the construction rules for atoms (let $ M_a$$ M_a$$ k\in\mathbb{N}$$ k$$ k$$ L$$ n$$ L$$ w\in L$$ n$$ w = xyz$$ \mid xy \mid \leq n$$ y \neq \epsilon$$ k &gt; 0$$ xy^kz \in L$$ x$$ y$$ z$$ L$$ L$$ n$$ M$$ L$$ \mid w \mid \geq \mid K\mid$$ M$$ M$$ L$$ L$$ L = {0^i1^i \m…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:reg&amp;rev=1532346470&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-07-23T14:47:50+03:00</dc:date>
        <title>lfa:reg</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:reg&amp;rev=1532346470&amp;do=diff</link>
        <description>Regular languages

Definition

In the previous lectures, we have introduced regular expressions, NFAs and DFAs as finite representations for languages, and showed the following links between them.

	*  $ E \rightarrow NA$  - each regular expression $ e$  can be transformed to a $ M$$ L(e) = L(M)$$ NA \rightarrow DA$$ M$$ M'$$ L(M) = L(M')$$ L$$ L=L(E)$$ E$$ LR\subset 2^{\Sigma^*}$$ L(NFA)\subset 2^{\Sigma^*}$$ L(DFA)\subset 2^{\Sigma^*}$$ LR \subseteq L(NFA) \subseteq L(DFA)$$ L(DFA) \subseteq L…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:team&amp;rev=1664880094&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-10-04T13:41:34+03:00</dc:date>
        <title>lfa:team</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=lfa:team&amp;rev=1664880094&amp;do=diff</link>
        <description>Limbaje Formale și Automate 2021-2022

Echipa

Curs

	*  Matei POPOVICI

Seminarii

	*  332CB Alexandra UDRESCU
	*  335CB Mihai UDUBASA
	*  334CB Mihai CALITESCU
	*  331CB Alexandru ILIE
	*  336CB Bogdan DEAC
	*  333CB Matei POPOVICI

Orar

Curs
 Frecevență  Zi  Interval orar   Profesor  săptămânal  Miercuri  10:00-12:00  Matei POPOVICI  săptămâni pare</description>
    </item>
</rdf:RDF>
