Giter Site home page Giter Site logo

goofyahprogramminglanguage's Introduction

GoofyAhProgrammingLanguage

Goofy ahhhhhhhh
Table of Contents:

Users Guide
Reccomended appplication structure

IMPORTANT LINKS:

Guide for the standard library: https://github.com/Electro-Corp/GoofyAhProgrammingLanguage/blob/main/stdlib/README.md#stdlib

Users Guide

Run a program

python3 main.py [FILE].gapl

Basic

The data segment is reserved for declearing variables or pushing constants to the stack.
The entry area is for the main exceution of the program.
Each program must have the two following sections:

  • data
  • entry Example:
data{
  // define two vars
  let x 1
  let y 1
  // push to the staack
  push x
  push y
}
entry{
  // add the two last items pushed to the stack
  add
}

Supported Built In functions

  • add
  • sub
  • out
  • push
  • los
  • cmp
  • jcb
  • goto
  • lfile
  • wfile
  • lchar
  • lspecInd
  • print
  • trchar
  • sload

push

Pushes an item to the stack

add/sum

To add, push two ints to the stack and then run add or sub. The result will be pushed to the output stack.

out

Prints the last item in the output stack

los

Sets a var to the last item on the output stack. Ex:

let g 0
push 3
push 4
add
// g will be 7
los g

sload

Loads a specific item from the stack into the outstack.

sload 2
trchar
print

cmp

Compares last two items on the stack. If they are equal, the condition bit is set to 1. Otherwise it is set to 0.

jcb

This will jump to the specified line if the condition bit is 1. Ex:

// jumps to line 15 is compare bit is 1
jcb 15

goto

Goes to the specified line. Ex:

goto 15

lchar

Loads a char to the charstack. Ex:

lchar hello!

print

Outputs the last item on the charstack. Ex:

lchar Hello!
print

trchar

Transfers the last item on the stack to the charstack. Ex:

push 3
trchar
// will print 3
print

lspecInd

Pushes the char array at the specific index offset from the top provided (length - indexProvided) to the front of the char stack (note that the original is not removed) Ex:

lchar Hey
lchar WhoAsked?
lspecInd 2 
// Hey is now at the front at the back of the char stack

NOTE: FOR FILES ITS RECOMMENDED TO USE THE STDLIB/FILEIO.GAPL for convenience

lfile

Loads a file based on the last item on the charstack, with the specified mode. Ex:

lchar helloworld.txt
lfile a

Modes:

  • a = Append
  • w = Write
  • r = Read

wfile

Appends to the current loaded file with the last item on the charstack. Ex:

lchar helloworld.txt
lfile w
lchar Hey!
wfile

Creating your own functions

To create your own function, create a seperate source file. Here it will be stdlib.gapl, a file part of the standard library. To create a function, use the func syntax, like so:

func puts{
  // code
}

To import the file in the main source, use include. Example:

include stdlib.gapl

Reccomended appplication structure

It is recommended to make programs like so:

  • mainFile.gapl
    • functionFile1.gapl
      -- subFunction1.gapl
    • functionFile2.gapl
      -- subFunction2.gapl
      -- subFunction3.gapl
      --- subsubFunction1.gapl
      Only one file may have the data and entry namespace. All other files must be a function file. Any imports the functions may have must be imported in the main file.

goofyahprogramminglanguage's People

Contributors

electro-corp avatar

Stargazers

 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.