Skip to content

Application generates random strings using the formal grammar given by user.

License

Notifications You must be signed in to change notification settings

stefanik36/String-From-Grammar-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String-From-Grammar-Generator

Application generates strings using the formal grammar given by user.

Default parse strategy is random.

Run application (Linux only)

gradle run

Examples:

example 1:

L(G) = {a^n b^n c^n | n≥1}
G(N,Ʃ,P,S)
Ʃ={a,b,c}
N={S,B}
S=S
P={
       S → aBSc | abc
       Ba → aB
       Bb → bb    
}

Generate Strings in String-From-Grammar-Generator:

+---------------------------------+
|  STRING FROM GRAMMAR GENERATOR  |
|          G = (N,Ʃ,P,S)          |
|                                 |
| N - nonterminal symbols         |
| Ʃ - terminal symbols            |
| P - production rules            |
| S - start symbol                |
+---------------------------------+
Set terminal symbols [Ʃ] (type "\next" to next step):

a [enter]

Ʃ = {a}

b [enter]

Ʃ = {a,b}

c [enter]

Ʃ = {a,b,c}

\next [enter]

Set nonterminal symbols [N] (type "\next" to next step):

S [enter]

N = {S}

B [enter]

N = {S,B}

\next [enter]

Set start symbol [S]:

S [enter]

Set productions rules [P] (type "\next" to next step):
production key:

S [enter]

production values (type "\next" to next production): 
S ->

aBSc [enter]

production values (type "\next" to next production): 
S -> aBSc

abc [enter]

production values (type "\next" to next production): 
S -> aBSc | abc

\next [enter]

production key:

Ba [enter]

S -> aBSc | abc
production values (type "\next" to next production): 
Ba ->

aB [enter]

production values (type "\next" to next production): 
Ba -> aB

\next [enter]

production key:

Bb [enter]

S -> aBSc | abc
Ba -> aB
production values (type "\next" to next production): 
Bb -> 

bb [enter]

production values (type "\next" to next production): 
Bb -> bb

\next [enter]

production key:

\next [enter]

Set number of generated strings:

3 [enter]

------------------
 [6] aabbcc
 [9] aaabbbccc
 [3] abc
------------------

In result: [X], X is the string length.

About

Application generates random strings using the formal grammar given by user.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages