Skip to content

A Parsing-as-Deduction system that parses with different parsing algorithms and some related tools for educational purposes.

Notifications You must be signed in to change notification settings

SamyaDaleh/CL-Toolbox

Repository files navigation

CL-Toolbox

Overview

A Parsing-as-Deduction system implemented in Java that parses everything and some related tools for educational purposes.

Check the documentation in /doc/doc.md for the list of currently supported algorithms and formalisms and all implementation details.

It prints out full parsing traces along with applied rules and antecedence items. Use it to generate examples, play around with grammars etc.

Without Installation

If you just want to get parsing traces of the most common algorithms, please visit http://cl-taskbox.de/. You can insert grammar and input for all algorithms listed there, afterwards click Help > Solve Task to get the full trace.

Installation

If you want to tinker with the code, for me it worked like this:

  • use your favorite IDE to clone/checkout the project
  • add the dependencies to your classpath/build path, preferable with the build.gradle file
  • run the JUnit tests in src.test to verify that everything is working. You should see some success messages and parsing outputs.

Logged-in GitHub users can download the latest jar from the Action tab.

Dependencies

See build.gradle.

Usage

Run it in your IDE.

If you downloaded or produced a jar, call with java -Dfile.encoding="UTF-8" -jar ... to correctly display special characters. Or call CL-Toolbox.bat (Windows) or CL-Toolbox.sh (Linux). They work with the same parameters, but you don't have to type in the encoding.

Video series about background and demonstration : English German

Examples:

java -jar CL-Toolbox.jar anbn.cfg "a a b b" cfg-topdown

true

1[S,0]axiom{}
2[a b,0]predict S -> a b{1}
3[a S b,0]predict S -> a S b{1}
4[b,1]scan{2}
5[S b,1]scan{3}
6[a b b,1]predict S -> a b{5}
7[a S b b,1]predict S -> a S b{5}
8[b b,2]scan{6}
9[S b b,2]scan{7}
10[b,3]scan{8}
11[a b b b,2]predict S -> a b{9}
12[a S b b b,2]predict S -> a S b{9}
13[ε,4]scan{10}

Where anbn.cfg is:

N = {S}
T = {a, b}
S = S
P = {S -> a S b, S -> a b}

CL-Toolbox.bat ancb.tag "a c b" tag-cyk --success

true

1[β,.1⊤,0,-,-,1]lex-scan a{}
3[α2,.1⊤,1,-,-,2]lex-scan c{}
7[β,.2⊤,1,1,2,2]foot-predict{}
12[α1,.2⊤,2,-,-,3]lex-scan b{}
15[β,ε⊥,0,1,2,2]move-binary{1, 7}
16[α2,ε⊥,1,-,-,2]move-unary{3}
19[β,ε⊤,0,1,2,2]null-adjoin{15}
21[α2,ε⊤,0,-,-,2]adjoin α2[ε,β]{16, 19}
23[α1,.1⊤,0,-,-,2]substitute α1[.1,α2]{21}
25[α1,ε⊥,0,-,-,3]move-binary{12, 23}
27[α1,ε⊤,0,-,-,3]null-adjoin{25}

Where ancb.tag is:

N = {S, T}
T = {a, b, c}
S = S
I = {α1 : (S T b), α2 : (T c)}
A = {β : (T a T*)}

Features

  • prints full traces or only successful traces
  • automatically transforms grammars into more expressive formalisms
  • can convert grammars to fit the algorithm
  • displays derivated trees for all algorithms
  • for TAG displays item trees on mouseover