Code Monkey home page Code Monkey logo

impulse's Introduction

Impulse Language

by DrBracket

DrBracket: William Vongphanith, Ari Gurovich, Jacob Kirmayer
APCS1

What is this

Our product is called... Impulse Language!
It is a novel performant programming language that is based on procedures and files.

Prerequisites

- JDK installed
- bash shell

Launch

javac Woo.java && java Woo (One time)
source ~/.bashrc
impulse [directory] [file (without .ipl)] [params]

Syntax

Parameter Declarations

Used to declare parameters to a file. Each file is one procedure.

param foo
param goo

Will declare foo and goo as variables taking the value of the first and second input into the procedure respectively

Variable Declarations

var foo = 4*5

Will declare foo as a variable taking a value of 20.

Result Declarations

res foo = f:4,5

Will declare foo as a variable, equal to the result of function f on 4 and 5. For f to be called, it must be in a file called f.ipl in the same directory.

Print Statements

Used to print numerical values.

print 1*2+5

will print a value of 7, for example.

Display Statements

Used to print strings.

display 1*2+5 

will print the string "1*2+5".

Conditional Statements

 if n>3
    return 3
 over
 return n

Begins with a boolean statement following 'if' and ends with 'over'. This piece of code will return n as long as it's no more than 3. If n is greater than 3, 3 is returned instead.

Math Operations

+ add
- subtract
* multiply
/ divide
^ exponent
% mod
[ forward parentheses
] reverse parentheses
> greater than
< less than
= equal to
PEMDAS is employed while parsing operations

Boolean operations

& and
| or

Configuration

The .iplrc

  This file will be created in your home directory. It should look something like this.
    
    precision 10
    scientific false
    
    You can use this to configure the display of numerical values

Sample Code

(choose.ipl) This code will calculate the number of ways to choose m items from a set of n, using recursion.

param m
param n
if m>n
  return 0
over
if m<0
  return 0
over
if n=0
  return 1
over
res chooseAll = choose: m,n-1
res chooseAllButOne = choose: m-1,n-1
print n
print m
print chooseAll+chooseAllButOne
return chooseAll+chooseAllButOne

BIG NOTE

Woo.java installs the whole language onto your computer (well really it just installs an alias but we can pretend it's very cool)

impulse's People

Contributors

thunder-red-star avatar jkirmayer30 avatar jsk11235 avatar foobar2016 avatar ivanazimoski avatar dvstatn 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.