Installation and Configuration Guide
Prerequisite Packages
Beluga requires the following packages, regardless of operating system. We recommend installing lrwrap to improve performance in Interactive mode.
MAC OS
All of the prerequisite packages are available through OPAM (OCaml package manager) for OCaml. Please visit their website for the details.
Linux
Under Debian Linux, all the necessary prerequisites can be installed with just the following command:
# apt-get install ocaml ocaml-findlib libextlib-ocaml-dev ocaml-ulex
The interactive mode is greatly improved if you have rlwrap installed, so you might also want to consider:
# apt-get install rlwrap
These commands may work under other distributions. The packages are also available through OPAM for OCaml
Microsoft Windows
Microsoft Windows
Beluga can be executed on Windows through Cygwin. The necessary prerequisites can be installed using the OCaml package manager called OPAM.
- Follow the instructions to install OCaml under Windows downloading and running the graphical installer from the OCaml installation page.
- From the start menu (or using the desktop icon) select Cygwin and launch it.
- Install the prerequisite packages using the command "opam install package_name".
Get Beluga
Clone Beluga from the GitHub repository https://github.com/Beluga-lang/Beluga.git by running
git clone https://github.com/Beluga-lang/Beluga.git
Building
Compile by running make from the Beluga directory:
~/beluga# make
Compilation Options
Setting the following environment variables for make enables the following compilation option:
For instance, to enable byte-code compilation, run:
~/beluga# make BYTE=true
Troubleshooting
Attempting to build Beluga before installing the prequisites may cause libraries to be only partially updated. You may receive a new error message once you've set up the prereq packages.
Error: The files [path/to/file] and [path/to/file] make inconsistent assumptions over interface [library name]
Try cleaning the Beluga directory.
~/beluga# make clean all
Executing Programs
Once you've built the Beluga executables, you can now run Beluga programs with the ./beluga/bin/beluga" executable.
~/beluga# bin/beluga path/to/program.bel
Emacs Mode
Beluga includes a major mode for programming in Emacs. The elisp file saved as ./beluga/tools/beluga-mode.el directory.
- Update your ~/.emacs configuration file with the lines written below. XEmacs users must
update ~/.xemacs and ~/.xema.cs/init.el with the same text. Create any of these files if
they do not exist already.
(add-to-list 'load-path "path/to/beluga/tools/") (load "beluga-mode.el")
- Add beluga/bin to your path; if Emacs does not detect your custom path, a quick fix is to create a symbolic link to the Beluga executable in a directory that is in the default Emacs path (such as /usr/bin).
- Restart Emacs.
Emacs will now launch Beluga-mode automatically when you open a program with the .bel suffix.