The REPL for Baguette#
Published: 23 Jan 2023
The Baguette# OCaml Interpreter
Baguette# is back!
Ocaml version >= 4.13.1, modules fmt,str and linenoise ( REPL )
opam install fmt str linenoise
Automatic download of the linux x86_64 binaries
curl https://raw.githubusercontent.com/coco33920/ocaml-baguettesharp-interpreter/master/download.sh | sh
the script downloads the latest binaries (which was tagged on the releases), install it as
~/.local/bin/baguette_sharp and flag it as executable. You can also do
wget https://raw.githubusercontent.com/coco33920/ocaml-baguettesharp-interpreter/master/download.sh sh download.sh
Or just executing the script itself
wget https://github.com/coco33920/ocaml-baguettesharp-interpreter/releases/latest/download/baguette.linux64 mv baguette.linux64 ~/.local/bin/baguette_sharp chmod +x ~/.local/bin/baguette_sharp
Build the latest stable version in OPAM repositories
opam install baguette_sharp it compile and install the latest baguette_sharp version under
baguette_sharp.repl in OPAM files (which are in
You must install the dependencies to build from sources, which are
linenoise. And an OCaml version of at least 4.13.1. An automatic script to download sources, install dependencies and build from source is available here :
curl https://raw.githubusercontent.com/coco33920/ocaml-baguettesharp-interpreter/master/automatic.sh | sh
Which is exactly :
opam install -y linenoise fmt git clone https://github.com/coco33920/ocaml-baguettesharp-interpreter cd ocaml-baguettesharp-interpreter dune build @install dune install
The script, same as OPAM, install the repl under
baguette_sharp.repl in the OPAM files.
I restarted this project early 2022, to act as a TIPE (a french weird oral exam for the concours of Écoles d'Ingénieurs) to frame the formal language theory, and to do that you'll play with our world famous pastries !
The lexer, parser and interpreter are finished, they take a string of language and transform it into an abstract syntax tree (AST) that the interpreter take to execute the language. I now work on the theoritical part of the issue (turing-completeness), and the compiler.
The syntax is really close to a BASIC but with less explicit words and keywords you'll see :)
The language supports integers, floating point numbers, strings, booleans, predicates, gotos, conditionnals gotos (if/else), and implements many of the standard instructions you can find in a language standard library. Keywords are simple and are the only instances when you don't need parenthesis, go see the WIKI for more accurate informations
dune build .
dune exec baguette_sharp_interpreter