Cocke–Younger–Kasami (CYK) algorithm - parsing algorithm for context-free grammars. This (standard) version of CYK operates on context-free grammars given in Chomsky normal form (CNF).
G = (T,N,P,S)
T - set of terminals
N - set of non-terminals
P - set of productions
S - start symbol
By default, grammar file is read from ./grammar.txt. The path can be specified by flag -path with a path to file as parameter.
File consist of four lines:
- list of terminals separated by space
- list of non-terminals separated by space
- list of productions separated by space
- start symbol (non-terminal)
Terminal t is represented by single [a-z] char,
a non-terminal N is represented by a single [A-Z] char
and production are represented by N>(NN|t|) string
(where N> is interpreted as epsilon production)