# README

Implementation of an alternative elimination of erasing rules in E0S grammars without
any predetermination of symbols that derive the empty string.

## Repository
Everything included in zip is mentioned and described here.

- Makefile - makefile for ubuntu
- README.md - this readme
- dip-final.pdf - pdf of text of thesis
- dip-final.zip - source codes of pdf of text of thesis
- hs-elim_e - binary file of Haskell application
- src - folder with source codes
  - elim_e.py - source code of Python
  - main.hs - source code of Haskell
  - requirements.txt - list of libraries for Python source code
- test - folder of tests
  - test1.in - first example of input
  - hs-test1.out - output generated by Haskell application for first input
  - py-test1.out - output generated by Python application for first input
  - test2.in - second example of input
  - hs-test2.out - output generated by Haskell application for second input
  - py-test2.out - output generated by Python application for second input
  - test3.in - third example of input
  - hs-test3.out - output generated by Haskell application for third input
  - py-test3.out - output generated by Python application for third input

## Build - Python
### Makefile
Following command should solve every dependency and necessity for running a program.
```bash
make py-install
```
### Manual
It is highly recommended to use a virtual environment, so following commands go as follows:

```bash
virtualenv elim_e-venv
source elim_e-venv/bin/activate
pip install -r requirements.txt
```

## Build - Haskell
### Makefile
Use the command:
```bash
make hs-build
```

This should compile source code into a running program.
### Manual
It is necessary to have some distribution of Haskell and a compiler installed. Then it is possible to compile a program with the following:

```bash
ghc -Wall --make -o hs-elim_e
```


## Run - Python
### Makefile
Makefile includes some examples of runs:
```bash
make py-run
```
```bash
make py-run1 
```
```bash
make py-run2
```
```bash
make py-run3
```
### Manual
The manual works via Python, so it is needed to run with Python. It is recommended
to run it with arguments. There are two possible arguments:
- i - to print out input grammar
- v - to print out output grammar
It is also possible to use both arguments to print input and output grammar in the
same execution.

For example:
```bash
python3 src/elim_e.py v test/test3.in
```

## Run - Haskell
### Makefile
Makefile includes some examples of runs:
```bash
make hs-run
```
```bash
make hs-run1 
```
```bash
make hs-run2
```
```bash
make hs-run3
```
### Manual
The manual works via an executable built in hs-build. It is recommended to run it
with arguments. There are two possible arguments:
- -i - to print out input grammar
- -v - to print out output grammar

For example:
```bash
./hs-elim_e -v test/test3.in
```
## Autor

Martin Havel
