ccglab
December 12, 2025 ยท View on GitHub
Combinatory Categorial Grammar (CCG): CCG and probabilistic CCG, with full set of combinators and their powers.
I DO NOT MAINTAIN CCGLAB ANYMORE, SINCE 2021. SORRY.
CCGlab is Common Lisp code with some bash scripts for install and run-time tokenization.
CCGlab needs a linux, a native one or one in macosphere or windowsphere.
INSTALL FOR LINUXSPHERE AND MACOSPHERE
-
git clone https://github.com/bozsahin/ccglab
This will create the repositoryccglabunder you current directory.
This is your ccglab home. -
cd ccglab - Execute
./installbash script in the repo to get the extras needed, and to set up the paths so that CCGlab is usable from anywhere in your user account.
Depending on your package manager, which is assumed to be either dnf, yum, apt-get, pacman, brew (in this pecking order if all are present in your system),
it will fetch sbcl and rlwrap (if not already present in your system). All linuxsphere (rolling and nonrolling distros, MACOS, Windows's WSL linux distros) have standard packages for these tools.
You can then run the ccglab script from anywhere after install.
Latest release is shown by (which-ccglab). Announced git releases may be slightly behind the latest,
which is always this copy. Just clone this repo rather than download the release if you want the latest.
INSTALL FOR WINDOWS
You need a linux system for CCGlab. Once you get that, follow the instructions for Linuxsphere for CCGlab install.
There are three options for windows (I recommend the first one):
- For windows 10 onwards: Follow these directions. No partitions, no virtualbox, no hassles. You now have linux as a W10 app with ccglab in it.
- For windows earlier than W10: install a virtual box such as Oracle's: https://www.virtualbox.org/.
Then follow one of the advices below for linuxes for ccglab install, depending on your virtual machine.
I recommend setting up an Ubuntu or Mint virtualbox if you have no prior linux experience.
If you use CCGLAB from a virtualbox, save your machine state rather than power off the virtual machine. You won't have to do all of the above over and over.
- For any windows: put a linux partition in your machine, and follow the instructions below depending on your linux. This one is for experienced users. This option is becoming easier too.
MANUAL INSTALL
If you're tired of weird defaults of linux installers, try the safe and longer way:
export the following bash variables:
CCGLAB_HOMEto where theccglabrepo isLALR_HOMEto where you saved lalrparser.lispCCGLAB_LISPto full path of your ANSI Common Lisp binaryRLWRAPto path ofrlwrapif you have it, otherwise nil, i.e.RLWRAP=PATH=:.:$CCGLAB_HOME/bin:$PATHto overrride earlier installs of ccglab.- Then open a new
bashterminal and runccglab
Here is my local setup in ~/.bashrc file (create one if you don't have it):
export CCGLAB_HOME=$HOME/mysrc/myrepos/ccglab
export LALR_HOME=$HOME/mysrc/lisp
export CCGLAB_LISP=/usr/local/bin/sbcl
export RLWRAP=rlwrap
export PATH=:.:$CCGLAB_HOME/bin:$PATH
And here is my ~/.bash_profile file (create one if you don't have it---bash may or may not use both):
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
The installer fetches the relevant sources (lalrparser, sbcl, rlwrap) and does the manual install automatically, and saves it in the files .bash_profile, .bashrc at your home.
Also have a look at the companion repo called ccglab-database, which contains grammars and models developed in CCGlab
COMMON LISPs FOR CCGLAB
SBCL and CCL Common Lisps are usable out of the box for CCGlab. The install script sets up SBCL for CCGlab if you haven't got one already. If you have an ANSI Common Lisp, it can work with it too.
GCL and CLisp are ANSI but the first one does not come with CLOS, and CLisp has weird locks on standard package files to turn them on. This is unfortunate because some CCGlab macros for the Lisp reader needs methods, therefore not usable in GCL/Clisp out of the box.
I added Allegro CL support for CCGlab (for calling bash scripts etc.), but somewhat reluctantly. Its free versions are so cryptic about heap control you will avoid it, and spend most of your time garbage-collecting rather than doing useful work. Not worth it, folks.
Design and development of CCGlab continues to be in SBCL, then occasionally checked with CCL. SBCL developers, you are my heros.
THE WRAPPER
You will appreciate the peace and comfort of the command-recaller rlwrap when you use a command-line tool like CCGlab. I am personally eternally grateful to its developers.
THE CCG WRAPPER
Steedman-notation for CCG is probably not SLR-parsable. I remember getting reduce-reduce conflicts in SLR which I didn't know how to eliminate without changing the notation. Thanks to Mark Johnson for the LALR parser, which is sufficient for CCG lexical entry and rule recognition.
enjoy.
--Cem Bozsahin