Giter VIP home page Giter VIP logo

snailbasic's Introduction

@yBASIC, pronounced “SnailBASIC” is a language subset for the 3DS interpreter SmileBASIC.

One problem people often have with BASIC dialects is that there are not enough punctuation characters required. @yBASIC attempts to remedy this. In fact, the only alphanumeric characters used are those for “GOTO”

Note that live snails (@y) are not permitted in SnailBASIC: only deceased snails (@_) are valid.

@yBASIC can take no input, because snails are obstinate and don’t care what you want them to do.

snailbasic.ps1 is a compiler from an assembly-like symbolic system to @yBASIC. Please submit issues as you encounter them.

Examples

source.txt:

MOV A,1
@0
PUSH
MOV A,A--A
PRINT A
GOTO @0

.\snailbasic source.txt -stdout

_$=""_=(!.)@_:GOTO "@__"+"_"*!!_@__:_$=_$+"."GOTO@____@___:_$=_$+"_"@____:_%=_%--!._=_--_?_:GOTO@_

Source Rules

  • One instruction per line.
  • Labels must begin at the first column of their line.
  • Labels are in the form @[0-9]+.
  • Labels must take sequential numbers to avoid unexpected behavior (the compiler generates labels starting at the end of <# user labels>.
  • PUSH, POP, UNSHIFT, and SHIFT all work directly with the A variable only.
  • Comments are begun by either ’ or ; and result in the rest of the line being ignored.
  • Valid variables are [A-Z]

Symbolic Language Instruction List

GOTO

GOTO @#

Jump to a label.

MOV

MOV [A-Z],Expression

Assign result of expression to a variable. Expressions undergo the following transformations:

  • [A-Z] -> respective _ variable
  • [0-9]+ -> (!.+) construction
  • 0 -> .

IF

IF [A-Z]

If the variable is truthy, evaluate the next instruction (do nothing). Otherwise, skip one instruction.

PRINT :likely to change:

PRINT [A-Z]

Print the value of the specified variable to console.

SET

SET [A-Z]

Write the logical value of A to the binary tape at the index specified

GET

GET [A-Z]

Read from the binary tape at the index specified into A

UNSHIFT

UNSHIFT

Unshift the logical value of A to the beginning of the binary tape

SHIFT

SHIFT

Shift the beginning of the binary tape into A

PUSH

PUSH

Push the logical value of A to the end of the binary tape

POP

POP

Pop the end of the binary tape into A

snailbasic's People

Contributors

y-ack avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.