Skip to content
Cocke-Younger-Kasami-Algorithm implemented in JavaScript
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
cyk.js

README.md

jsCYK

  1. Details

  2. How to use jsCYK

  3. License

  4. Credits

1. Details

2. How to use jsCYK

2.1 Installation

This algorithm can be used in the browser or any other JavaScript environment. To use it in the browser, type:

<script src="https://raw.githubusercontent.com/lagmoellertim/jsCYK/master/cyk.js"></script>

2.2 Usage

To use jsCYK, you need to define a startstate, the grammar and the word. This is an example for it:

var startstate = "S"

grammar_yt_vid = {
    S:["SA","a"],
    A:["BS"],
    B:["BB","BS","b","c"]
}

word = "abacba"

Next, you need to create an object of the jsCYK class, which includes the startstate and the grammar.

cyk = new CYK(grammar_yt_vid, startstate)

To check whether a word is part of the language or not, use this:

cyk.checkWord(word) //Returns true or false

If you want to see the table that is generated as a part of this algorithm, use this:

cyk.outputTable(word)

3. License

This implementation is published under the MIT License.

4. Credits

This implementation is developed by Tim-Luca Lagmöller.

You can’t perform that action at this time.