Skip to main content

Introduction

AllSpeak is a high-level English-like domain-specific scripting language (DSL) suited for prototyping and rapid testing of ideas. It operates on the command line and a graphics module is under construction. The language is written in Python and it acts as a fairly thin wrapper around standard Python functions, giving fast compilation and good runtime performance for general applications.

AllSpeak is well suited to building command-line or graphical applications for expressing random logic such as operating procedures and rules, or controlling physical systems, particularly those using wifi devices. It is easy to construct and issue REST commands to local or remote web servers.

For more advanced applications, AllSpeak is designed to be extensible, by enabling extra language syntax to be added via plugin-in modules. Once these are installed they act as seamless extensions to the basic syntax provided. AllSpeak derives its power from the use of rich and comprehensive language rather than a complex system of frameworks such as those commonly used in modern programming. This makes it very easy to learn as our brains are wired to operate that way. Having said that, the needs of most control systems are usually served by a fairly modest number of keywords and syntactic variants.


There is also a JavaScript version of AllSpeak, which provides a full set of graphical features to run in a browser. For this, please visit

Repository: https://github.com/easycoder/allspeak.ai
Website: https://allspeak.ai


Quick Start

Install AllSpeak in your Python environment:

pip install requests allspeak-ai

Test the install by typing the command allspeak.


On Linux, this will probably fail as the installer places the executable file in the `$HOME/.local/bin` directory. So give the command `export PATH=$HOME/.local/bin:$PATH`.

To make this change permanent, edit your .profile file, adding the following:

# set PATH so it includes user's private .local/bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Now write a test script, hello.allspeak, containing the following:

print `Hello, world!`
exit

(Note the backticks.) This is traditionally the first program to be written in virtually any language. To run it, use allspeak hello.allspeak — or just allspeak hello, since .allspeak is assumed when the extension is left off.

The output will look like this (the version number will likely differ):

AllSpeak version 250403.1
Compiled <anon>: 1 lines (2 tokens) in 0 ms
Run <anon>
Hello, world!

Why the exit? Because AllSpeak can't tell that the program is finished. It might contain elements that are waiting for outside events, so without exit it just stops and waits. You can kill it by typing Control-C.

It's conventional to add a program title to a script:

!   Test script
    script Test
    log `Hello, world!`
    exit

The first line here is just a comment and has no effect on the running of the script. The second line gives the script a name, which is useful in debugging as it says which script was running. I've also changed print to log to get more information from the script. When run, the output is now

AllSpeak version 250403.1
Compiled Test: 3 lines (4 tokens) in 0 ms
Run Test
16:37:39.132311:    3-> Hello, world!

As you might guess from the above, the log command shows the time and the line in the script it was called from. This is very useful in tracking down debugging print commands in large scripts.

Here in the repository is a folder called scripts containing some sample scripts:

fizzbuzz.allspeak is a simple programming challenge often given at job interviews
tests.allspeak is a test program containing many of the AllSpeak features
benchmark.allspeak allows the performance of AllSpeak to be compared to other languages if a similar script is written for each one.

Graphical programming

AllSpeak includes a graphical programming environment based on PySide6, that is in under development. Some demo scripts will be included in the scripts directory as development proceeds. Anyone wishing to track progress can do so via this repository. At the time of writing we are transitioning from an early version based on PySimpleGUI to one based on PySide, the latter being an open product that matches the needs of a DSL better than does the former.

Significant features

  • English-like syntax based on vocabulary rather than structure. Scripts can be read as English
  • Comprehensive feature set
  • Runs directly from source scripts. A fast compiler creates efficient intermediate code that runs immediately after compilation
  • Low memory requirements
  • Minimim dependency on other 3rd-party packages
  • Built-in co-operative multitasking
  • Dynamic loading of scripts on demand
  • The language can be extended seamlessly using plugin function modules
  • Plays well with any Python code
  • Fully Open Source

Programming reference

AllSpeak comprises a set of modules to handle tokenisation, compilation and runtime control. Syntax and grammar are defined by packages, of which there are currently two; the core package, which implements a comprehensive set of command-line programming features, and and the graphics package, which adds graphical features in a windowing environment.

See also How it works

Extending the language

AllSpeak can be extended to add new functionality with the use of 'plugins'. These contain compiler and runtime modules for the added language features. AllSpeak can use the added keywords, values and conditions freely; the effect is completely seamless. There is an outline example in the plugins directory called example.py, which comprises a module called Points with new language syntax to deal with two-valued items such as coordinates. In the scripts directory there is points.allspeak, which exercises the new functionality.

A plugin can act as a wrapper around any Python functionality that has a sensible API, thereby hiding its complexity. The only challenge is to devise an unambiguous syntax that doesn't clash with anything already existing in AllSpeak.

MQTT token formats

The MQTT plugin supports both plain-token and encrypted-token forms:

mqtt
    token PlainTokenValue
    id MyID
    broker `mqtt.flespi.io`
    port 8883
    subscribe MyTopic
mqtt
    token EncryptedTokenValue SecretKeyValue
    id MyID
    broker `mqtt.flespi.io`
    port 8883
    subscribe MyTopic

Both EncryptedTokenValue and SecretKeyValue can be any AllSpeak value (string literal or variable). When two values are provided after token, AllSpeak decrypts the token before creating the MQTT client. This decryption path requires the Python package cryptography.

Contributing

We welcome contributions to AllSpeak-py! Please see our CONTRIBUTING.md guide for:

  • Getting started with development
  • How to work with Git branches and merge changes
  • Resolving merge conflicts
  • Testing and submitting pull requests

Metadata

Release files for allspeak-ai 2610121218

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for allspeak-ai 2610121218
File Size Uploaded Provenance
allspeak_ai-2610121218.tar.gz 3.1 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for allspeak-ai 2610121218
File Interpreter ABI Platform
allspeak_ai-2610121218-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 3.3 MB

Release files / allspeak_ai-2610121218.tar.gz

Download URL allspeak_ai-2610121218.tar.gz
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
f782d56eadd19910db458582631eb5df04f62feb804057afca4976beb238b443
BLAKE2b-256 checksum
How to use checksums
213ed385c7cfd441afbfab2d3ca61c593f30530a033eb1f51e6e10f37ba3bcaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / allspeak_ai-2610121218-py2.py3-none-any.whl

Download URL allspeak_ai-2610121218-py2.py3-none-any.whl
Size 217.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4f20665fcf7f307a30f028ca34126580e7dd88633b2acdc8c4681ed388bebba1
BLAKE2b-256 checksum
How to use checksums
77b4e9a4db37652490024501f4f26e8a70ca28b1ff619233131166bb254cbbf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Security for allspeak-ai 2610121218

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

2610121218 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page