box is a text-based visual programming language inspired by Unreal Engine Blueprint function graphs.

Overview

Box is a text-based visual programming language inspired by Unreal Engine blueprint function graphs.

$ cat factorial.box

 ┌─ƒ(Factorial)───┐                     ┌─[Branch]─────┐                       ┌─[Set]─┐
 │               ►┼─────────────────────┼►       True ►┼───────────────────────┼►     ►┼─────────┐         ┌─[For Loop]───────────┐                   ┌───────┐
 │             n ○┼──┐               ┌──┼○      False ►┼──┐  ┌──────────┐  ┌───┼○      │         └─────────┼►          Loop body ►┼───────────────────┼►      │
 └────────────────┘  │    ┌────────┐ │  │              │  │  │  result ○┼──┘ ┌─┼○      │                   │                      │ ┌──────────┐ ┌────┼○  *=  │
             ┌────┐  └────┼○  >=  ○┼─┘  └──────────────┘  │  └──────────┘    │ └───────┘         ┌────┐    │                      │ │  result ○┼─┘  ┌─┼○      │
             │ 1 ○┼───────┼○       │                      │       ┌────┐     │                   │ 1 ○┼────┼○ start               │ └──────────┘    │ └───────┘
             └────┘       └────────┘                      │       │ 1 ○┼─────┘                   └────┘    │                      │                 │
                                                          │       └────┘                                   │               index ○┼─────────────────┘
                                                          │                        ┌────┐                  │                      │
                                                          │                        │ n ○┼─┐  ┌───────┐     │                      │
                                                          │                        └────┘ └──┼○  +   │     │                      │
                                                          │                        ┌────┐ ┌──┼○     ○┼─────┼○ end                 │
                                                          │                        │ 1 ○┼─┘  └───────┘     │                      │
                                                          │                        └────┘                  │                      │
                                                          │                                      ┌────┐    │                      │
                                                          │   ┌─[Return]─┐                       │ 1 ○┼────┼○ step                │
                                                   ┌────┐ └───┼►         │                       └────┘    │           Completed ►┼────┐
                                                   │ 1 ○┼─────┼○         │                                 └──────────────────────┘    │  ┌─[Return]─┐
                                                   └────┘     └──────────┘                                               ┌─────────┐   └──┼►         │
                                                                                                                         │ result ○┼──────┼○         │
                                                                                                                         └─────────┘      └──────────┘

$ box factorial.box -e 5
120

$ box factorial.box -e 5
87178291200

$ box factorial.box -o factorial.py

$ cat factorial.py
def Factorial(n):
    if (n >= 1):
        result = 1
        for index_8b6ee4f2 in range(1, (n + 1), 1):
            result *= index_8b6ee4f2
        return result
    else:
        return 1

Getting Started

Install the box interpreter with pip

pip3 install boxlang

Now open your text editor and start drawing your program! Check out existing samples here.

Anatomy of a Box

A Box has 2 types of ports: control flow ports (─►┼─) and data flow ports (─○┼─). These ports can additionally be classified as input or output ports. All ports to the left side of a box are input ports and all ports on the right side of the box are output ports.

Below, you can see a [For Loop] box which is a special type of box that the interpreter can parse - It has 1 input control flow port, 3 input data flow ports (start, end, and step), 2 output control flow ports (the loop body and completed control flows), and 1 output data flow port (the index)

image

Function Graphs

Box programs are function graphs. Functions have a single entry point designated by a node with the name of the Function containing a single output control flow port.

Here's a simple hello world example. This example declares a Greet() function that prints the string "Hello, World!" to the console. It calls the built-in print function.

image

Execute the above program with the box interpreter like so:

$ box samples/hello_world.box -e
Hello,World!

Features

  • Function declarations
  • Defining constants and variables
  • Operators - Unary, binary, and assignment operators
  • [Set] - set the value of variables
  • Function calls - Call Python built-in functions
  • [Branch] - if-else box
  • [For Loop] - Python-style for loop with (start,end,step)
  • [While Loop] - Python-style while loop
  • [For Each] for iterables
  • [Break] and [Continue] boxes
  • [Return] box to return values from functions

Gotchas

  • The interpreter will likely fail if you have tabs in your file - replace all tabs with the appropriate number of spaces
  • There are a number of UNICODE character you'll need for this to work - Just look through the samples and COPY-PASTE (no, seriously)

Contributing

Contributions are welcome, have a look at the CONTRIBUTING.md document for more information.

License

The project is available under the MIT license.

Owner
Pranav
Pranav
A simple text editor for linux

wolf-editor A simple text editor for linux Installing using Deb Package Download newest package from releases CD into folder where the downloaded acka

Focal Fossa 5 Nov 30, 2021
A neat little program to read the text from the "All Ten Fingers" program, and write them back.

ATFTyper A neat little program to read the text from the "All Ten Fingers" program, and write them back. How does it work? This program uses the Pillo

1 Nov 26, 2021
Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)

Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)

Kevin Lai 1 Nov 08, 2021
一个可以可以统计群组用户发言,并且能将聊天内容生成词云的机器人

当前版本 v2.2 更新维护日志 更新维护日志 有问题请加群组反馈 Telegram 交流反馈群组 点击加入 演示 配置要求 内存:1G以上 安装方法 使用 Docker 安装 Docker官方安装

机器人总动员 117 Dec 29, 2022
Hotpotato is a recipe portfolio App that assists users to discover and comment new recipes.

Hotpotato Hotpotato is a recipe portfolio App that assists users to discover and comment new recipes. It is a fullstack React App made with a Redux st

Nico G Pierson 13 Nov 05, 2021
The Levenshtein Python C extension module contains functions for fast computation of Levenshtein distance and string similarity

Contents Maintainer wanted Introduction Installation Documentation License History Source code Authors Maintainer wanted I am looking for a new mainta

Antti Haapala 1.2k Dec 16, 2022
Python character encoding detector

Chardet: The Universal Character Encoding Detector Detects ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants) Big5, GB2312, EUC-TW, HZ-GB-2312, IS

Character Encoding Detector 1.8k Jan 08, 2023
A production-ready pipeline for text mining and subject indexing

A production-ready pipeline for text mining and subject indexing

UF Open Source Club 12 Nov 06, 2022
Converts a Bangla numeric string to literal words.

Bangla Number in Words Converts a Bangla numeric string to literal words. Install $ pip install banglanum2words Usage

Syed Mostofa Monsur 3 Aug 29, 2022
split Word file by chapter

split Word file by chapter we use the mircosoft word api to code this tool api url:https://docs.microsoft.com/zh-cn/dotnet/api/ if this tool is good f

wisdom under lemon trees 5 Nov 06, 2021
A program that looks through entered text and replaces certain commands with mathematical symbols

TextToSymbolConverter A program that looks through entered text and replaces certain commands with mathematical symbols Example: Syntax: Enter text in

1 Jan 02, 2022
BaseCrack is a tool written in Python that can decode all alphanumeric base encoding schemes.

BaseCrack Decoder For Base Encoding Schemes BaseCrack is a tool written in Python that can decode all alphanumeric base encoding schemes. This tool ca

Mufeed VH 383 Dec 27, 2022
Wordle strategy: Find frequency of letters appearing in 5-letter words in the English language

Find frequency of letters appearing in 5-letter words in the English language In

Gabriel Apolinário 1 Jan 17, 2022
Goblin-sim - Procedural fantasy world generator

goblin-sim This project is an attempt to create a procedural goblin fantasy worl

3 May 18, 2022
CowExcept - Spice up those exceptions with cowexcept!

CowExcept - Spice up those exceptions with cowexcept!

James Ansley 41 Jun 30, 2022
A minimal python script for generating multiple onetime use bip39 seed phrases

seed_signer_ontimes WARNING This project has mainly been used for local development, and creation should be ran on a air-gapped machine. A minimal pyt

CypherToad 4 Sep 12, 2022
Vector space based Information Retrieval System for Text Processing - Information retrieval

Information Retrieval: Text Processing Group 13 Sequence of operations Install Requirements Add given wikipedia files to the corpus directory. Downloa

1 Jan 01, 2022
Athens: a great tool for taking notes and organising knowldge

AthensSyncer Athens is a great tool for taking notes and organising knowldge. But it is a bummer that you cannot use it accross multiple devices. Well

6 Dec 14, 2022
Split large XML files into smaller ones for easy upload

Split large XML files into smaller ones for easy upload. Works for WordPress Posts Import and other XML files.

Joseph Adediji 1 Jan 30, 2022
Correcting typos in a word based on the frequency dictionary

Auto-correct text Correcting typos in a word based on the frequency dictionary. This algorithm is based on the distance between words according to the

Anton Yakovlev 2 Feb 05, 2022