Word: abbbabaa G = ({a, b}, {S, A, B, E, C, X, Y, Z}, P, S) With Productions P as: A -> a | YE | XC B -> b | XE | YZ C -> AA E -> YB | XA S -> YB | XA | * X -> b Y -> a Z -> BB Applying CYK-Algorithm: +-------+-------+-------+-------+-------+-------+-------+-------+ | a | b | b | b | a | b | a | a | +-------+-------+-------+-------+-------+-------+-------+-------+ | A,Y | B,X | B,X | B,X | A,Y | B,X | A,Y | A,Y | +-------+-------+-------+-------+-------+-------+-------+-------+ | E,S | Z | Z | E,S | E,S | E,S | C | +-------+-------+-------+-------+-------+-------+-------+ | B | - | B | B | A | A | +-------+-------+-------+-------+-------+-------+ | Z | Z | Z | E,S | C | +-------+-------+-------+-------+-------+ | B | - | B | A | +-------+-------+-------+-------+ | Z | Z | E,S | +-------+-------+-------+ | B | B | +-------+-------+ | E,S | +-------+ The word abbbabaa is an element of the CFG G and can be derived from it.
Note: In order to help you runing this proyect please use the following link and download the pluging for xtext
- Xtext plugin
- Folow the steps for installing the plugin in your eclipse IDE
-
Download this repository and open it as a workspace
-
Once you have it, please go to the proyect
org.xtext.cyk
*and open de the file *MyFNC.xtext
locaded here: -
Rigth click on the file
MyFNC.xtext
and selectRun as -> Generate xtext artifacts
-
Rigth click on the file
GenerateMyFNC.mwe2
and selectRun as -> 1 MWE2 WorkFlow
-
Rigth click on the proyect
org.xtext.cyk
and selectRun as -> Eclipse aplication
it will open a new Eclipse IDE -
On that new IDE create a new Java proyect, then at the folder
src
create a new file with the extention.fnc
-
In your new file
.fnc
write your grammar as in the following pic you can paste it from the filetest.txt
-
For writing the word that you'd like to test with the cyk algorithm , first write the reserved word
Check
enclose in quotation marks the string that you want to taste -
Finally check the folder
src-gen
and you will find the output in the fileresult.txt