cham

command module
v0.0.0-...-44ce166 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 2 Imported by: 0

README

cham

A programming language based on the Chemical Abstract Machine.

This repository contains the source code for an interpreter that can run programs written in the language.
Some additional documentation can be found in the docs/ directory.

Language

  • A guide explaining how the language works can be found in language.md.
  • The language syntax is described in syntax.md and is accompanied by a BNF grammar in syntax.ebnf.
  • Some sample programs can be found in programs.md.

Interpreter

The interpreter is written using the Go programming language.

You can compile from source if you have the Go toolchain installed on your system. Just execute go build from the root project directory.

Alternatively, you can download pre-built binaries for Windows, MacOS and Linux. These can be found on GitHub under the Actions tab. Just select the build you want, then download the desired binary from the Artifacts section.

Using the interpreter on Mac or Linux

After compiling or downloading the binary, run the following in the Terminal.

$ ./cham
Using the interpreter on Windows

After compiling or downloading the binary, run the following in the Command Prompt.

$ cham.exe
Interpreter modes

The interpreter has two modes.

In REPL mode, the interpreter creates a prompt into which you can continuously run programs or execute commands. Defined programs will be stored in memory until the process exits.

In command-line mode, you can perform one-off operations using the interpreter, such as evaluating a program (either from a command-line argument or read from a file) or viewing the raw output from the lexer or parser.

To view usage information, run ./cham -h (Mac/Linux) or cham.exe -h (Windows).

Interpreter Design

The interpreter follows a fairly standard design. Program source code passes through a lexer and parser, and is then evaluated.

The evaluator is capable of executing "reaction" programs in parallel.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL