Skip to content

Commit e8b10f5

Browse files
committed
Update README.md
1 parent 984bf65 commit e8b10f5

File tree

3 files changed

+91
-48
lines changed

3 files changed

+91
-48
lines changed

README.md

+91-44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# LangToGroup
22

3+
[![Build Status](https://travis-ci.org/YaccConstructor/LangToGroup.svg?branch=master)](https://travis-ci.org/YaccConstructor/LangToGroup)
4+
35
This project provides an opportunity to build a grammar group representation in two ways, which is displayed in the following picture:
46
![](media/approaches.png)
57

@@ -36,65 +38,68 @@ This conversion uses different set of generators as opposed to the first convers
3638

3739
<img src="https://latex.codecogs.com/png.latex?\\&space;G(T)&space;=&space;\{&space;q,&space;h,&space;s_0,&space;\ldots,&space;s_M,&space;q_0,&space;\ldots,&space;q_N,&space;q^R_0,&space;\ldots,&space;q^R_N&space;\}&space;\\&space;R(T)&space;=&space;\forall&space;\alpha&space;\in&space;0..N,&space;\beta&space;\in&space;0..M&space;:&space;\\&space;\begin{array}{r@{~=~}lc@{~if~}c@{~\in&space;T}}&space;q_i&space;s_j&space;&&space;q_l&space;s_k&space;&&space;&&space;q_i&space;s_j&space;s_k&space;q_l&space;\\&space;q_i&space;s_j&space;&&space;s_j&space;q_l&space;&&space;&&space;q_i&space;s_i&space;R&space;q_l&space;\\&space;s_j&space;q^R_i&space;&&space;q^R_l&space;s_j&space;&&space;&&space;q_i&space;s_i&space;L&space;q_l&space;\\&space;q_\alpha&space;s_\beta&space;&&space;s_\beta&space;q^R_\alpha&space;\\&space;q_\alpha&space;h&space;&&space;s_0&space;q^R_\alpha&space;h&space;\\&space;h&space;q^R_\alpha&space;&&space;h&space;q_\alpha&space;s_0&space;\\&space;q_0&space;s_\beta&space;&&space;q_0&space;\\&space;s_\beta&space;q_0&space;h&space;&&space;q_0&space;h&space;\\&space;h&space;q_0&space;h&space;&&space;q&space;\end{array}" />
3840

39-
## Build status
40-
[![Build Status](https://travis-ci.org/YaccConstructor/LangToGroup.svg?branch=master)](https://travis-ci.org/YaccConstructor/LangToGroup)
41-
4241
## Building
43-
To build run:
44-
45-
``stack build``
42+
```bash
43+
stack build
44+
```
4645

4746
## Testing
48-
For run the tests:
49-
50-
``stack test``
47+
```bash
48+
stack test
49+
```
5150

5251
## Usage
5352
```bash
54-
stack run -- LangToGroup-cli
53+
stack run -- LangToGroup-cli <options>
5554
```
5655

57-
```
58-
Usage: LangToGroup-cli <options>
59-
60-
Options:
61-
-i file_path --input=file_path Full path to file with grammar definition
62-
-o file_path --output=file_path Full path to file for printing results
63-
-e file_path --error=file_path Full path to file, where errors should be recorded during parsing
64-
-a approach --approach=approach Used approach (see section `Approaches`)
65-
-L --LaTeX Print result in LaTeX format (while doesn't work)
66-
-I objects --info=objects Print useful information about objects (see section `Objects`)
67-
-h --help Print help and exit
68-
69-
Approaches:
70-
first
71-
Implementation of algorithm from "Isoperimetric and Isodiametric Functions of Groups"
72-
second
73-
Implementation of algorithms from "Boolean grammars" and "An Introduction to the Theory of Groups"
74-
second_a
75-
Modifications of `second` approach with modified algorithm from "An Introduction to the Theory of Groups"
76-
second_b
77-
Modifications of `second` approach with modified algorithm from "An Introduction to the Theory of Groups"
78-
79-
Objects:
80-
grammar
56+
### Options
57+
* `-i file_path` `--input=file_path`
58+
Full path to file with grammar definition
59+
* `-o file_path` `--output=file_path`
60+
Full path to file for printing results
61+
* `-e file_path` `--error=file_path`
62+
Full path to file, where errors should be recorded during parsing
63+
* `-a approach` `--approach=approach`
64+
Used approach (see section [Approaches](#approaches))
65+
* `-I objects` `--info=objects`
66+
Print useful information about objects (see section [Objects](#objects))
67+
* `-h` `--help`
68+
Print help and exit
69+
70+
### Approaches
71+
* `first`
72+
Implementation of algorithm from [Isoperimetric and Isodiametric Functions of Groups](https://arxiv.org/abs/math/9811105)
73+
* `second`
74+
Implementation of algorithms from [Boolean grammars](https://doi.org/10.1016/j.ic.2004.03.006) and [An Introduction to the Theory of Groups](https://doi.org/10.1007/978-1-4612-4176-8)
75+
* `second_a`
76+
Modifications of `second` approach with modified algorithm from [An Introduction to the Theory of Groups](https://doi.org/10.1007/978-1-4612-4176-8)
77+
* `second_b`
78+
Modifications of `second` approach with modified algorithm from [An Introduction to the Theory of Groups](https://doi.org/10.1007/978-1-4612-4176-8)
79+
80+
### Objects
81+
* `grammar`
8182
Input grammar (context-free, conjunctive or boolean)
82-
turing_machine, tm
83+
* `turing_machine`, `tm`
8384
Produced Turing machine (its type depends on used approach)
84-
group_presentation, gp
85+
* `group_presentation`, `gp`
8586
Produced group presentation
86-
Note: When enumerating objects, they must be separated by commas WITHOUT SPACES!
8787

88-
For more information see https://github.com/YaccConstructor/LangToGroup/blob/master/README.md
89-
```
88+
> **NOTE**: When enumerating objects, they must be separated by commas WITHOUT SPACES!
9089
91-
For example, if you want build presentation of grammar via second modification of the second approach and get metrics of produced group presentation and Turing machine, you should type options:
92-
`-i grammar.txt -a second_b -I tm,gp`
90+
### Examples
9391

94-
And if you want to build presentation of grammar via first approach and save produced group presentation to file, you should type options:
95-
`-i grammar.txt -o group_presentation.txt -a first`
92+
* ```bash
93+
stack run -- LangToGroup-cli -i grammar.txt -a second_b -I tm,gp
94+
```
95+
If you want build presentation of grammar via second modification of the second approach and get metrics of produced group presentation and Turing machine
9696

97-
Examples of grammar files given below.
97+
* ```bash
98+
stack run -- LangToGroup-cli -i grammar.txt -o group_presentation.txt -a first
99+
```
100+
If you want to build presentation of grammar via first approach and save produced group presentation to file
101+
102+
### Examples of grammar
98103

99104
**Boolean grammar**
100105

@@ -168,3 +173,45 @@ Here are the tables with some examples of building group presentations by differ
168173
| <img src="https://render.githubusercontent.com/render/math?math=\{ww \mid w \in \{a,b\}*\}">| Boolean| 14 | 2498 | 20200 | 455220 |
169174
| <img src="https://render.githubusercontent.com/render/math?math=\{a^{m} b^{n} c^{n} \mid (m != n), m, n \in N\}"> | Boolean | 14 | 3461 | 27655 | 683100 |
170175

176+
## Execution (old version)
177+
178+
> **NOTE**: Old CLI was saved because some of posibilities aren't available in new CLI.
179+
180+
For run experiments and print its numerical results you can use `is_det <bool>` flag.
181+
182+
So, for print experiments' results using deterministic symmetrization:
183+
184+
```bash
185+
stack exec -- LangToGroup-printer --is_det true
186+
```
187+
188+
using nondeterministic symmetrization:
189+
190+
```bash
191+
stack exec -- LangToGroup-printer --is_det false
192+
```
193+
194+
195+
### Printing example transformations in LaTeX
196+
Grammar's transformations also can be printed in LaTeX. For this should be used `--print_example <grammar>` flag.
197+
The following grammars can be used as print examples: "one\" --- one rule grammar, \"a*\" --- grammar for regular language
198+
<img src="https://render.githubusercontent.com/render/math?math=L = \{a*\}">
199+
, \"dyck\" --- Dyck language grammar.
200+
201+
For example,
202+
203+
```bash
204+
stack exec -- LangToGroup-printer --is_det true --print_example one
205+
```
206+
207+
Output filename can be specified by ``-o <filename>`` flag.
208+
209+
### Printing example group presentation in Gap-format file
210+
For this you can use `-G` flag without a parameter, but with `--is_det <bool>` and `--print_example <grammar>` flags.
211+
Also, output filename can be specified by `-o <filename>` flag, if it does not speccified it been printing with default filename "out.txt".
212+
213+
For example, following prints in "out.txt" a group presentation, which obtained from Dyck language grammar using nondeterministic symmetrization:
214+
215+
```bash
216+
stack exec -- LangToGroup-printer -G --is_det false --print_example dyck
217+
```

app/Config.hs

-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ getConfig = go defaultConfig
3333
OutputFile fp -> go (applyApproach & apprConfig . outputFile .~ fp) os
3434
ErrorFile fp -> go (applyApproach & apprConfig . errorFile .~ fp) os
3535
UsedApproach appr' -> go (applyApproach & approach .~ appr') os
36-
GPinLaTeX -> go applyApproach os
3736
InfoAbout objs -> go (applyApproach & apprConfig . infoAbout \/~ objs) os
3837
Help -> return PrintHelp

app/Option.hs

-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ data Option =
1616
| OutputFile FilePath
1717
| ErrorFile FilePath
1818
| UsedApproach Approach
19-
| GPinLaTeX
2019
| InfoAbout (Set Object)
2120
| Help
2221

@@ -30,8 +29,6 @@ options =
3029
"Full path to file, where errors should be recorded during parsing"
3130
, Option "a" ["approach"] (ReqArg (fmap UsedApproach . getApproach) "approach")
3231
"Used approach (see section `Approaches`)"
33-
, Option "L" ["LaTeX"] (NoArg (return GPinLaTeX))
34-
"Print result in LaTeX format (while doesn't work)"
3532
, Option "I" ["info"] (ReqArg (fmap InfoAbout . getObjects) "objects")
3633
"Print useful information about objects (see section `Objects`)"
3734
, Option "h" ["help"] (NoArg (return Help))

0 commit comments

Comments
 (0)