BASIC build system and package manager.

Related tags

Command-line bargo
Overview

Bargo

BASIC build system and package manager.

Bargo is a tool to make it simpler to program in the BASIC programming language. Early versions of BASIC, like for instance BBC BASIC up to version 4 required the user to include line numbers and didn't allow the code to be split into different files, one for each dependency/module. Bargo abstracts these and other limitations from the programmer, allowing to code without using line numbers and spliting the code into multiple files, one per dependency/module.

Features

  • Automatic line numbering
  • Customisable line numbering
  • Customisable newline chars
  • Dependency/module management
  • Project cleaning
  • Project creation
  • Project build
  • Project tracking with Git

Build

To build bargo you need the Rust toolchain as well as these dependencies:

  • serde = "1.0.197"
  • toml = "0.8.12"

Follow these steps to fetch and compile the source of bargo and its dependencies:

git clone https://github.com/vascocosta/bargo.git
cd bargo
cargo build --release

Install

Simply copy bargo/target/release/bargo to a folder in your path (ex: $HOME/bin).

Usage example

Bargo allows you to create a project template for your BASIC program, so that editing your code is simpler.

Follow the steps below to create a new project template, cd into the project, edit some files with your favourite editor (replace $editor with your favourite editor) and finally build it.

bargo new age
cd age
$editor Bargo.toml 
$editor src/main.bas
$editor src/utils.bas
bargo build
  1. Create a new project called age.
  2. Change the current folder to your project folder called age.
  3. Edit Bargo.toml, which is the configuration file of your project.
  4. Edit src/main.bas which by convention is where you define your main program.
  5. Edit src/utils.bas which is a dependency/module used by your main program.
  6. Build your project.

The final step builds your project by merging src/main.bas with all the dependencies/modules your project uses into a single file called age.bas at the root of your project folder and automatically numbering the lines for you.

In this simple example there's only src/utils.bas, but you could use any number of dependencies/modules. For each dependency/module you should create a bas file with the name of that dependency/module inside src and add the name to the [dependencies] section of Bargo.toml, plus its version. For now the version isn't important, but it will be used in the future. For example, if you were to add another dependency/module called math, you would need to create src/math.bas with math related procedures/functions and then add math = "0.1.0" to Bargo.toml under the [dependencies] section.

Below you can see a listing of all the files used in this example, plus the final source code of age.bas that is generated for you.

Bargo.toml

Your BASIC project is configured by editing age/Bargo.toml:

[package]
name = "age"
carriage_return = true
numbering = 10
version = "0.1.0"

[dependencies]
utils = "0.1.0

src/main.bas

Your main source file is created by editing age/src/main.bas:

PROC_INIT_SCREEN
PRINT "Hello!"
PRINT
PRINT "What is the current year?"
INPUT CURRENT_YEAR%
PRINT "What year were you born in?"
INPUT BIRTH_YEAR%
AGE% = FN_CALCULATE_AGE%(CURRENT_YEAR%, BIRTH_YEAR%)
PRINT "You are " + STR$(AGE%) + " years old."
END

src/utils.bas

Your utils dependency is created by editing age/src/utils.bas:

DEF PROC_INIT_SCREEN
MODE 3
CLS
ENDPROC
:
DEF FN_CALCULATE_AGE%(CURRENT_YEAR%, BIRTH_YEAR%)
= CURRENT_YEAR% - BIRTH_YEAR%
ENDDEF

age.bas

Your final source code age.bas is generated by bargo build:

 10 PROC_INIT_SCREEN
 20 PRINT "Hello!"
 30 PRINT
 40 PRINT "What is the current year?"
 50 INPUT CURRENT_YEAR%
 60 PRINT "What year were you born in?"
 70 INPUT BIRTH_YEAR%
 80 AGE% = FN_CALCULATE_AGE%(CURRENT_YEAR%, BIRTH_YEAR%)
 90 PRINT "You are " + STR$(AGE%) + " years old."
100 END
110 :
120 REM ============================================================================
130 REM IMPORT UTILS.BAS
140 REM ============================================================================
150 :
160 DEF PROC_INIT_SCREEN
170 MODE 3
180 CLS
190 ENDPROC
200 :
210 DEF FN_CALCULATE_AGE%(CURRENT_YEAR%, BIRTH_YEAR%)
220 = CURRENT_YEAR% - BIRTH_YEAR%
230 ENDDEF
You might also like...
A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.)

FS Dir Cache A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.) When working on build s

An efficient pictures manager based on custom tags and file system organization.

PicturesManager An efficient pictures manager based on custom tags and file system organization. Developed with Tauri (web app) with a Rust backend an

Thyme -- The classy build system.
Thyme -- The classy build system.

The Thyme build system. Welcome to the Thyme build system! It chops, it dices, it links, it builds and Oh my! Do I see Lua? 👀 Quick introduction The

A build system from the future 🖖

warp is an friendly, fast, correct, and extensible build system built for polyglot monorepos that uses JavaScript for its configuration and is built i

A CLI utility installed as
A CLI utility installed as "ansi" to quickly get ANSI escape sequences. Supports the most basic ones, like colors and styles as bold or italic.

'ansi' - a CLI utility to quickly get ANSI escape codes This Rust project called ansi-escape-sequences-cli provides an executable called ansi which ca

Sniffer - a tool to quickly inspect csv and flat-file files for basic information
Sniffer - a tool to quickly inspect csv and flat-file files for basic information

sniffer sniffer is a tool to quickly inspect csv and flat-file files for basic information. Need to see how many rows are in a csv file? Want to see t

Baby's first Rust CLI project. Basic implementation of grep. Written in about 100 SLOC.

minigrep Coding project from Chapter 12 of the The Rust Programming Language book. Usage Compile and run as so minigrep QUERY FILENAME QUERY being the

Basic vim-like editor for Redox-OS

red red is an editor based on vim written in Rust. Goal of this project is to provide a basic command-line editor, much like nano. Targeted for Redox.

Basic template for an out-of-tree Linux kernel module written in Rust.

Rust out-of-tree module This is a basic template for an out-of-tree Linux kernel module written in Rust. Please note that: The Rust support is experim

Releases(v0.2.0)
Owner
Vasco Costa
AKA gluon on IRC. Enthusiastic about technology, computing and science. Loves operating systems and physics. Yes I'm a geek, I also enjoy other stuff though.
Vasco Costa
Gecko's trusty package manager and command-line utility.

Geckos have super-powers, ya'know? Grip is Gecko's trusty package manager and command-line utility. USAGE: grip [FLAGS] [file] [SUBCOMMAND] FLAGS

Gecko 2 Jan 3, 2022
The safe, fast and sane package manager for Linux

moss-rs A rewrite of the Serpent OS tooling in Rust, enabling a robust implementation befitting Serpent and Solus We will initially focus on moss and

Serpent OS 16 Oct 10, 2023
Yfin is the Official package manager for the Y-flat programming language

Yfin is the Official package manager for the Y-flat programming language. Yfin allows the user to install, upgrade, and uninstall packages. It also allows a user to initialize a package with the Y-flat package structure and files automatically generated. In future, Yfin will also allow users to publish packages.

Jake Roggenbuck 0 Mar 3, 2022
Yet another package manager for Rust.

Rpip Installing. Make sure you have just (packages) installed! Once you have just installed move into the root directory (where this file is) and run

null 2 Apr 27, 2022
📦 A Python package manager written in Rust inspired by Cargo.

huak About A Python package manager written in Rust. The Cargo for Python. ⚠️ Disclaimer: huak is currently in its proof-of-concept (PoC) phase. Huak

Chris Pryer 186 Jan 9, 2023
📦 A Python package manager written in Rust inspired by Cargo.

huak About A Python package manager written in Rust. The Cargo for Python. ⚠️ Disclaimer: huak is currently in its Alpha phase. Huak aims to support a

Chris Pryer 161 Oct 9, 2022
🗽 Universal Node Package Manager

?? NY Universal Node Package Manager node • yarn • pnpm Features Universal - Picks the right package manager for you based on the lockfile in your fol

Kris Kaczor 46 Oct 12, 2023
A new gen package manager, written in rust

Run It run it is a package manager that is based on containers (yes like apx but declarative and written in rust), the difference is that run it is we

null 7 Sep 6, 2024
Tool to build OSX package installers

?? Pak MacOS package installer builder What does pak do? Pak builds MacOS package installers from a project file. Since apple removed PackageBuilder f

ash 2 Feb 21, 2022
Build Java applications without fighting your build tool. Drink some espresso.

Espresso Build Java applications without fighting your build tool. Drink some espresso. Features Modern Look & Feel Command line interface inspired by

Hunter LaFaille 5 Apr 2, 2024