Skip to the content.

REPL

Table of Contents

Next Page : Basic Usage

Prerequisite

The executable of baguette-sharp, either from the precompiled binaries downloadable in the header or from compiling/installing the project with

dune build/install

here the executable is assumed to be baguette_sharp and in the $PATH

General command line

typing in a terminal

baguette_sharp --help

gives you the help of the command which is

help

REPL Commands

Not specifying an input file launch the REPL for example baguette_sharp alone launch the REPL

repl

The REPL top commands are the following

N.B the following command are equivalent:

baguette_sharp --verbose

and

baguette_sharp

then toggling verbose on. Same with the lexer

REPL

Variable

By default the REPL shows the information about an incoming variable.
The example bellow shows what happens when typing only Hello in the prompt

hello

And the difference between adding and printing the addition:

diff

The same code interpreted through a file only shows the latter

file

Hinting

The REPL shows hint when a function / keyword is typed
Function

cr

Keyword

k

Auto-completion

Lastly the REPL editor uses Linenoise to provide auto-completion when using baguette commands

autocomp

Command Line

The Command Line Version of Baguette# just execute the file for example

baguette_sharp --input examples/math.baguette

Shows

math

Errors

In the last version (2.0) of Baguette# a real system of errors (without the way of handling them just yet though) has been implemented. Here is some example

Wrong Type

typerror The error was raised because MADELEINE take a string as parameter and 0 is an integer

Syntax

syntaxerror The error was raised because the variable test we were trying to access do not exist

List of errors

there is _ types of error