Skip to content

Commit c0caba3

Browse files
authored
merge homework8
2 parents eedbb99 + 8bf41a4 commit c0caba3

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

grammar.pdf

85.6 KB
Binary file not shown.

grammar.tex

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
\documentclass[12pt]{article}
2+
\title{Definition Homework}
3+
\usepackage {amsmath}
4+
\usepackage {amssymb}
5+
\usepackage{enumerate}
6+
\usepackage{cmap}
7+
\usepackage{mathtext}
8+
\usepackage[T2A]{fontenc}
9+
\usepackage[utf8]{inputenc}
10+
\usepackage[english,russian]{babel}
11+
\usepackage{indentfirst}
12+
13+
\setlength{\textwidth}{7.0in}
14+
\setlength{\oddsidemargin}{-0.35in}
15+
\setlength{\topmargin}{-0.5in}
16+
\setlength{\textheight}{9.0in}
17+
\setlength{\parindent}{0.3in}
18+
\usepackage{alltt}
19+
\begin{document}
20+
\indent
21+
\section{Определение грамматики}
22+
\begin{enumerate}
23+
\item $\Sigma = \{[a-zA-Z],.,\backslash, let, =, (, ),\backslash n\}$
24+
\item $N = \{application, definition, defname, term, lambda-abstraction, variable, input\}$
25+
\item $S = input$
26+
\item $P:$
27+
\begin{enumerate} [1)]
28+
\item $<definition> ::= let <defname> = <term>$.
29+
\item $<defname> ::= A | B | ... | Z \{a | b | ... | z | A | B | ... | Z \}$.
30+
\item $<term> ::= <application> | (<term>) | <lambda-abstraction> | <variable> | <~defname>$
31+
\item $<variable> ::= a | b | ... | z \{a | b | ... | z | A | B | ... | Z \}$
32+
\item $<lambda-abstraction> = \backslash<variable>\{<variable>\}.<term>$
33+
\item $<application> = <term> <term>$
34+
\item $<input> = \{<definition> \backslash n\} <term>$.
35+
\end{enumerate}
36+
\end{enumerate}
37+
\section{Пример}
38+
\begin{verbatim}
39+
let S = \ x y z.x z (y z)
40+
let K = \ x y.x
41+
S K K
42+
\end{verbatim}
43+
$$<input> \Rightarrow <definition> \backslash n \{<definition> \backslash n\} <term> \Rightarrow$$
44+
Первое $definition$:
45+
\begin{eqnarray}
46+
<definition>\Rightarrow \\
47+
let <termname> = <term> \Rightarrow \\
48+
let\ S = <term> \Rightarrow \\
49+
let \ S = <lambda-abstraction> \Rightarrow \\
50+
let \ S = \backslash<variable>\{<variable>\}.<term> \Rightarrow \\
51+
let \ S = \backslash<variable><variable><variable>.<term> \Rightarrow \\
52+
let \ S = \backslash x <variable><variable>.<term> \Rightarrow \\
53+
let \ S = \backslash x y <variable>.<term> \Rightarrow \\
54+
let \ S = \backslash x y z.<term> \Rightarrow \\
55+
let \ S = \backslash x y z.<application> \Rightarrow \\
56+
let \ S = \backslash x y z.<term> <term> \Rightarrow \\
57+
let \ S = \backslash x y z.<application> <term> \Rightarrow \\
58+
let \ S = \backslash x y z.<term> <term> <term> \Rightarrow \\
59+
let \ S = \backslash x y z.<variable> <term> <term> \Rightarrow \\
60+
let \ S = \backslash x y z.x <term> <term> \Rightarrow \\
61+
let \ S = \backslash x y z.x <variable> <term> \Rightarrow \\
62+
let \ S = \backslash x y z.x z <term> \Rightarrow \\
63+
let \ S = \backslash x y z.x z (<term>) \Rightarrow \\
64+
let \ S = \backslash x y z.x z (<application>) \Rightarrow \\
65+
let \ S = \backslash x y z.x z (<term> <term>) \Rightarrow \\
66+
let \ S = \backslash x y z.x z (<variable> <term>) \Rightarrow \\
67+
let \ S = \backslash x y z.x z (y <term>) \Rightarrow \\
68+
let \ S = \backslash x y z.x z (y z) \Rightarrow
69+
\end{eqnarray}
70+
Итог:
71+
\begin{verbatim}
72+
let S = \ x y z.x z (y z)
73+
\end{verbatim}
74+
Второе $definition$:
75+
\begin{eqnarray}
76+
<definition>\Rightarrow \\
77+
let <termname> = <term> \Rightarrow \\
78+
let \ K = <term> \Rightarrow \\
79+
let \ K = <lambda-abstraction> \Rightarrow \\
80+
let \ K = \backslash<variable>\{<variable>\}.<term> \Rightarrow \\
81+
let \ K = \backslash<variable><variable>.<term> \Rightarrow \\
82+
let \ K = \backslash x <variable>.<term> \Rightarrow \\
83+
let \ K = \backslash x y.<term> \Rightarrow \\
84+
let \ K = \backslash x y z.<variable> \Rightarrow \\
85+
let \ K = \backslash x y z.x \Rightarrow
86+
\end{eqnarray}
87+
Итог:
88+
\begin{verbatim}
89+
let S = \ x y z.x z (y z)
90+
let K = \ x y.x
91+
\end{verbatim}
92+
$term$:
93+
\begin{eqnarray}
94+
<term>\Rightarrow \\
95+
<application> \Rightarrow \\
96+
<term> <term> \Rightarrow \\
97+
<application> <term>\Rightarrow \\
98+
<term> <term> <term> \Rightarrow \\
99+
<defname> <defname> <defname> \Rightarrow \\
100+
S K K \Rightarrow
101+
\end{eqnarray}
102+
Итог:
103+
\begin{verbatim}
104+
let S = \ x y z.x z (y z)
105+
let K = \ x y.x
106+
S K K
107+
\end{verbatim}
108+
\end{document}

0 commit comments

Comments
 (0)