Package for creating interpreters

GoDoc Go Report Card Build Status Code Coverage

sand

sand is for creating interpreters, like the Python interpreter and Haskell interpreter. It can also be used for creating text based games and CLI test environments.

For examples, check out the examples folder.

Design

sand implements a concurrent model. It views an interpreter as two seperate components: the User Interface, sand.UI, and the Command Processor,sand.Engine. The following diagram shows how under the hood sand operates. Every square is a goroutine.

+--------+                            +--------------------------+
|        |              +------------->     Engines Manager      +--------------+
|  Read  <----------+   |             +--------------------------+              |
|        |          |   |                                                       |
+----+---+          |   |                                                       |
     |            +-+---+------+                                        +-------v------+
     |            |            |                                        |              |     +----------+
     +------------>     UI     |                                        |    Engine    |     |  Engine  |
                  |  (usually  +---------------------------------------->    Runner    +---->+   Exec   |
     +------------>    main)   |                                        |              |     |          |
     |            |            |      XXXXXXXXXXXXXXXXXXXXXXXXXXXX      |              |     +----------+
     |            +-+----------+      X   Manager connects UI    X      +--------------+
+----+---+          |                 X   to Engine Runner       X
|        |          |                 XXXXXXXXXXXXXXXXXXXXXXXXXXXX
| Write  <----------+
|        |
+--------+

sand.UI is a struct that is provided for you and is implemented as broad as possible; however there are few features missing, which are commonly found in popular interpreters, namely: Line history and Auto-completion. These features may be added later, but as for now they are not planned for.

sand.Engine is an interface, which must be implemented by the user. Implementations of sand.Engine must have a comparable underlying type, see Go Spec for comparable types in Go.

Similar Resources

CLI - A package for building command line app with go

CLI - A package for building command line app with go

Command line interface Screenshot Key features Lightweight and easy to use. Defines flag by tag, e.g. flag name(short or/and long), description, defau

Dec 23, 2022

The standard library flag package with its missing features

cmd Package cmd is a minimalistic library that enables easy sub commands with the standard flag library. This library extends the standard library fla

Oct 4, 2022

Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.

Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.

Sensible and fast command-line flag parsing with excellent support for subcommands and positional values. Flags can be at any position. Flaggy has no

Jan 1, 2023

A collection of CLI argument types for the Go `flag` package.

flagvar A collection of CLI argument types for the flag package. import "github.com/sgreben/flagvar" Or just copy & paste what you need. It's public d

Sep 26, 2022

Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Dec 30, 2022

A simple, fast, and fun package for building command line apps in Go

cli cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable comm

Dec 31, 2022

Color package for Go (golang)

Color package for Go (golang)

color Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang). It has support for Windows too! The API can be used in severa

Dec 31, 2022

Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

asciigraph Go package to make lightweight ASCII line graphs ╭┈╯. Installation go get github.com/guptarohit/asciigraph Usage Basic graph package main

Jan 8, 2023

Go (golang) package with 70+ configurable terminal spinner/progress indicators.

Go (golang) package with 70+ configurable terminal spinner/progress indicators.

Spinner spinner is a simple package to add a spinner / progress indicator to any terminal application. Examples can be found below as well as full exa

Dec 26, 2022
Comments
  • [bug] Data race in UI

    [bug] Data race in UI

    Send on closed channel occurs if context was previously cancelled and UI is ran again with the same Engine.

    Proposed solutions:

    • On context cancellation Engine channel should removed from map.
    • Specify some special context stuff in order to determine Engine shutdown
Related tags
minectl 🗺 is a cli for creating Minecraft (java or bedrock) server on different cloud provider.

minectl ?? minectl️️ is a cli for creating Minecraft (java or bedrock) server on different cloud provider. It is a private side project of me, to lear

Jan 3, 2023
Interactive CLI helper for creating git branches with JIRA Links and some text

bb (better-branch) Interactive CLI helper for creating git branches with JIRA Links and some text Still in development? Yes How it works? This tiny ut

Aug 18, 2022
Simple CLI App for creating recurring google calendar events

Kronus A CLI App to help you stay in touch with the people that matter by leveraging the google calender API. You can create touchbase events for cont

Nov 7, 2022
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.
tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files.

tigrfont - bitmap font sheet generator for TIGR tigrfont is a commandline tool for creating bitmap font sheets for TIGR from TTF or BDF font files. TI

Dec 5, 2022
Command line tools for creating and compiling JavaScript Minecraft plugins.

@customrealms/cli CustomRealms command-line tools for setting up and compiling JavaScript Minecraft plugins. Installation Install the CLI on your comp

Aug 2, 2022
Simple CLI tool for creating gotd sessions.

Simple CLI tool for creating gotd sessions.

Sep 29, 2022
eksctl is a simple CLI tool for creating clusters on EKS
eksctl is a simple CLI tool for creating clusters on EKS

eksctl is a simple CLI tool for creating clusters on EKS - Amazon's new managed Kubernetes service for EC2. It is written in Go, and uses CloudFormation.

Jan 7, 2023
Creating a simple CLI tool in the Go Programming Language for personal learning and fun

Creating a simple CLI tool in the Go Programming Language for personal learning and fun Open to feedback :) Build docker dev environment docker build

Dec 12, 2021
mlp is a comman line tool responsible for creating, updating and deleting kubernetes resources based on files generated by Mia-Platform Console.

mlp is a comman line tool responsible for creating, updating and deleting kubernetes resources based on files generated by Mia-Platform Console.

Apr 28, 2022
Dev-spaces - A CLI to help creating development environments using AWS Spot Instances

This is a CLI to help creating on-demand development spaces using EC2 Spot Intances.

Nov 9, 2022