A stack-based systems language that supports structures, functions, expressions, and user-defined operator behaviour

Overview

GeneralBasic

A stack-based systems language that supports structures, functions, expressions, and user-defined operator behaviour. Currently compiles to URCL with plans to add additional formats in the future.

Why Python?

The initial implementation of this compiler is written in Python. This allowed for flexibility during development and guaranteed portability across major platforms. This compiler may be ported to other languages in the future should the need arise.

Invoking the Compiler

python gb.py -o MyProgram.urcl MyProgram.gb
Argument Description
gb.py This is the main compiler script.
-o This is the output flag, which indicates the argument that should be used for the name of the output file.
MyProgram.urcl The name of the output file.
MyProgram.gb The name of an input source file. Multiple source files can be included.

GeneralBasic Syntax

Structures

Structures are a data type that can store multiple pieces of information, called fields.

Structure Ball
	Dim X As Integer
	Dim Y As Integer
End Structure

Pointers

Pointers are declared by adding an asterisk (*) to the end of the referenced type name.

Dim ballAddress As Ball*

A pointer can be dereferenced by using the ValueOf operator.

Dim ballAddress As Ball*

...

Dim ball As Ball
ball = ValueOf(ballAddress)

A pointer to a variable can be obtained using the AddressOf operator.

Dim ball As Ball

...

Dim ballAddress As Ball*
ballAddress = AddressOf(ball)

Type Casting

Type casting can be performed with the As operator.

Dim ballAddress As Ball*
ballAddress = 0x100 As Ball*

Functions and Subroutines

Functions can be declared with pass-by-value parameters and a return value.

Function AddNumbers(a As Integer, b As Integer) As Integer
	Return a + b
End Function

If a return value is not required, a subroutine can be used instead.

Sub PrintNumbers(a As Integer, b As Integer)
	Print(a)
	Print(b)
End Sub

Parameters can be made to pass-by-reference by adding ByRef before the parameter name.

Sub Bounce(ByRef this As Ball)
	this.Y = this.Y * -1
End Sub

Inline Assembly

Inline assembly allows for custom operations not supported by the compiler to be implemented on the target platform. Each command is prefixed with the Asm keyword followed by one of three command names: Load, Save, or Exec.

Load accepts one variable as an argument and pushes it onto the local stack.

Save accepts one variable as an argument and pops a value from the local stack into it.

Exec accepts one or more arguments and emits them as a raw instruction.

Sub AddOne(ByRef value As Integer)
	Asm Load value
	Asm Exec pop R1
	Asm Exec inc R1 R1
	Asm Exec psh R1
	Asm Save value
End Sub

Inline assembly statements are not exempt from emitter-level optimization and may be simplified or modified in cases such as extraneous stack operations or unused registers. Care should be taken to not modify the program's base pointer, as doing so could lead to unexpected or unsafe behaviour.

Owner
Lucida Dragon
Lucida Dragon
Easy Google Translate: Unofficial Google Translate API

easygoogletranslate Unofficial Google Translate API. This library does not need an api key or something else to use, it's free and simple. You can eit

Ahmet Eren Odacı 9 Nov 06, 2022
Role Based Access Control for Slack-Bolt Applications

Role Based Access Control for Slack-Bolt Apps Role Based Access Control (RBAC) is a term applied to limiting the authorization for a specific operatio

Jeremy Schulman 7 Jan 06, 2022
Minecraft name sniper written in python.

⚠️ IMPORTANT ⚠️ DO NOT USE MCSNIPERPY -- READ BELOW This sniper does not support Microsoft accounts or prename / gc sniping and is MUCH harder to use

MCsniperPY 201 Dec 30, 2022
Retrieve information from DBLP and update BibTex files automatically

Rebib TLDR: This script retrieves information from DBLP to update your BibTex files. python rebib.py --bibfile xxx.bib It first parses the bib entries

Shangtong Zhang 49 Jan 01, 2023
Catinthebox - Awesome bot for Mastodon

Cat In The Box :3 Description Awesome bot for Mastodon Requirements python pip g

satanist 0 Jan 19, 2022
Pydf: A modular Telegram Bot which provides Pdf Tools using PyPdf2

pyDF-Bot 🌍 Pydf - Pyrogram Document File Bot, a modular Telegram Bot which prov

HyDrix 2 Feb 18, 2022
AWS Quick Start Team

EKS CDK Quick Start (in Python) DEVELOPER PREVIEW NOTE: Thise project is currently available as a preview and should not be considered for production

AWS Quick Start 83 Sep 18, 2022
Discord bot for playing Werewolf game on League of Legends.

LoLWolf LoL人狼をプレイするときのDiscord用botです。 (Discord bot for playing Werewolf game on League of Legends.) 以下のボタンを押してbotをあなたのDiscordに招待することで誰でも簡単に使用することができます。

Hatsuka 4 Oct 18, 2021
PancakeTrade - Limit orders and more for PancakeSwap on Binance Smart Chain

PancakeTrade helps you create limit orders and more for your BEP-20 tokens that swap against BNB on PancakeSwap. The bot is controlled by Telegram so you can interact from anywhere.

Valentin Bersier 187 Dec 20, 2022
Bulk convert image types with Python

Bulk Image Converter 🔥 Helper script to convert a folder's worth of images from one filetype to another, and optionally delete originals Use Setup /

1 Nov 13, 2021
Solves bombcrypto newest captcha

Solves Bombcrypto newest captcha A very compact implementation using just cv2 and ctypes, ready to be deployed to your own project. How does it work I

19 May 06, 2022
Telegram Auto Filter Bot

Pro Auto Filter Bot V2.o Hey Mo Tech, I'm an Autofilter bot v2.O and you can not Add Me to your Group. I was made for this one group. So don't waste y

14 Oct 20, 2021
Azure free vpn for students only! (Self hosted/No sketchy services/Fast and free)

Azpn-Azure-Free-VPN Azure free vpn for students only! (Self hosted/No sketchy services/Fast and free) This is an alternative secure way of accessing f

Harishankar Kumar 6 Mar 19, 2022
Discord Mass Report script that uses multiple tokens

Discord-Mass-Report Discord Mass Report script that uses multiple tokens, full credits to https://github.com/hoki0/Discord-mass-report who made it in

cChimney 4 Jun 08, 2022
Python Business Transactions Library - ContractsPY

Python Business Transactions Library - ContractsPY Declare and define business transactions in Python. Use the contracts library to validate business

Arzu Huseynov 7 Jun 21, 2022
Opensea-upload-with-recaptcha-solution - Updated opensea uploading solution with recaptcha pass

opensea-upload-with-recaptcha-solution updated opensea uploading solution with r

byeonggeon sim 25 Nov 15, 2022
Tools convert cookies facebook menjadi token facebook.

Tools convert cookies facebook menjadi token facebook.

Muhammad Latif Harkat 2 Jul 17, 2022
🦈 Blahaj is a discord bot that shares random images of himself on discord.

🦈 Blahaj Bot Blahaj is a discord bot that shares random images of himself on discord. ⚙️ Developer's Guide To use the bot, follow along the steps Hea

Atul Anand 3 Oct 21, 2022
Telegram Link Shortener Bot (With 20 Shorteners)

Telegram ShortenerBot ShortenerBot: 🇬🇧 Telegram Link Shortener Bot (11 + 9 Shorteners) 🇹🇷 Telegram Link Kısaltıcı Bot (11 + 9 Kısaltıcı) All suppo

Hüzünlü Artemis [HuzunluArtemis] 10 May 24, 2022
Download videos from Youtube and other platforms through a Telegram Bot

ytdl-bot Download videos from YouTube and other platforms through a Telegram Bot Usage: https://t.me/benny_ytdlbot Send link from YouTube directly to

Telegram Bot Collection 289 Jan 03, 2023