Giter VIP home page Giter VIP logo

arbasm's Introduction

Arbitrary Assembly

Interpreter and command line interface for an assembly language-styled scripting language, mainly featuring arbitrary digit integer arithmetic.

The scripts/ folder has some examples of what it's like to use this language.

Very work in progress.

Table of contents

Compilation (feat. GNU make)

To compile it, enter

$ make

in your favorite shell.
To compile and run it, enter

$ make run

It uses gcc, but apperantly the gcc command is symlinked to clang sometimes. That being said, it has also been tested with clang, so it should be alright either way.
There is a syntax highlighting file for the text editor micro in the scripts directory. If formicro is added as a flag for make, it will place the syntax file in what should be the right place:

$ make formicro

To compile for windows, enter

$ make forwindows

Running the program

After compilation, the program can be run like so:

$ ./aasm

It might need execute permission, in which case:

$ sudo chmod +x ./aasm

should do the trick.
For ease of reading, the rest of this document assumes the program is either in the path variable, or aliased in some way.

aasm can take arguments from the shell:

$ aasm <script> <options>
Option Description
-c Enter command line after the script has stopped running.
-i <statement> Executes the designated statement. This statement can not contain spaces.
-e Exit immediately after executing the statement that was passed as argument of -i.
-l <statefile> Loads the designated statefile before interpreting any statements.
-b Sets the notation to big endian before interpreting any statements.
-v Displays the name, version and libraries.
-h Prints this table.
--------------

Scripting and the CLI

A script is a simple text file with the .aa (arbitrary assembly) extension. One line can not contain more than one instruction. comments start at a semicolon (;) and end at the end of the line. The interpreter executes the script line by line, looping at the end depending on the loop register. If the register is 0, the script will not loop, and exit the script. If loop is 1, the script will loop until loop is 0 again.
A script runs in the instance it is called in.
Running a script can be run from the shell with aasm, and in scripts and the arbasm CLI with (the standard library instruction):
run <string or register containing a string>,
which runs the script the path of which is given by the string.

If aasm is run without any arguments, or with the appropriate options, the program enters the command line interface. Here it will prompt the user with three backslashes (\\\ ), and statements can be entered. After a statement has been executed, the result it returns is printed to the console.

Syntax, registers and instructions

Every statement is of the form:

<instruction mnemonic(s)> <arguments seperated by commas>

Elaborate documentation lives on the wiki

arbasm's People

Contributors

stevenclifford avatar technicjelle avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

technicjelle

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.