Skip to main content

celeref-lang

A versatile interpreter in python to execute programs written in JSON.

Installation

First you need to install python 3. Now you can install the package via pip:

$ python -m pip install --user -U celeref-lang
# In linux, you might have to use `python3` instead.
# Make sure to check `python --version` first.

Test if it is installed successfully:

$ celeref
# It should print a help message

$ celeref --version
# It should print the installed version

If it says celeref is not found, follow this help:

Writing your first program

You need a code-editor that supports intellisense for JSON schema. My preference is Visual Studio Code.

  • Create a JSON file in Visual Studio Code
  • Add the schema path located in src/schema folder. See examples in examples folder for help.

With schema defined, editor will catch schema errors and auto-suggest available expressions.

Here is a sample program written in celeref-lang:

{
  "$schema": "https://raw.githubusercontent.com/dipu-bd/celeref-lang/master/src/schema/schema.json",
  "name": "Hello World",
  "program": [
    {
      "state": "Hello World"
    },
    {
      "print": "state"
    }
  ]
}

Save the program to hello-world.json file, and run it using:

$ celeref hello-world.json
----------
Hello World

------ 0.000 seconds ------

Building from source

You need Python 3 to execute this script.

  • Clone the repository first
  • Create a new virtual environment
    • python -m venv venv
  • Activate it;
    • In Windows: venv\Scripts\activate
    • In Linux: venv/bin/activate
    • In MacOS: venv/bin/activate
  • Now install dependencies:
    • pip install -U wheel pip
    • pip install -r requirements.txt
  • Now to run the script:
    • python src <path/to/your-source.json>

E.g. To run the hello-world.json example:

$ python src examples/hello-world.json
Hello World

Documentation

This project in under development. APIs are subjected to change in future. Documentation is further away. Follow schema descriptions for basic documentation for now.

To note a few basic things:

  • state is a very important variable in this program. After executing a statement, the result is always stored in state first.

  • After program has finished running the final value of state will be the result.

  • To pass and array or objects as arguments to call method, you can use { "state": <your array or object> }.

  • To display a list of all available functions:

$ celeref -s
  • To search for specific functions, pass a query after -s:
$ celeref -s mod
----- [divmod] -----
Return the tuple (x//y, x%y).  Invariant: div*y + mod == x.

----- [math.fmod] -----
Return fmod(x, y), according to platform C.

x % y may differ.

----- [math.modf] -----
Return the fractional and integer parts of x.

Both results carry the sign of x and are floats.

----- [op.mod] -----
mod(a, b) -> number
Same as `a % b`

Find the modulus of two numbers

Metadata

Release files for celeref-lang 0.0.7

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

Built distribution (wheel)

Table of built distributions (wheels) for celeref-lang 0.0.7
File Interpreter ABI Platform
celeref_lang-0.0.7-py3-none-any.whl Python 3 none any Details

Release files / celeref_lang-0.0.7-py3-none-any.whl

Download URL celeref_lang-0.0.7-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7af36e6037d48d9489fff212562c358a0545f32b53a2124277968fdb9337819
BLAKE2b-256 checksum
How to use checksums
c7b41434f3d6c40399da5f6ea75522543f4ac3f22e5f2dd3aab28078f8c14c7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Security for celeref-lang 0.0.7

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.

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