Skip to content

A programming language designed to look like math and be used like a calculator

Notifications You must be signed in to change notification settings

JBrosDevelopment/calc_lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator Language

This is a programming langauage that makes it extremely straightforward to program mathamatical expressions.

Functions

lerp(A, B, T) => A + T * (B - A)
display(lerp(0, 50, 100))

Variables

(5 * 60)^3 -> X
99 -> Y
XY -> Z
display(Z)

Constants

3.14159 -> pi
pi * 2 -> tau

Comments

... display alt character function
dac(120) ... '120' is the alt-code for 'x'
... displays 'x' to the console 

If Patterns

... returns X if X > Y, else returns Y
max(X, Y) => X > Y: X; Y

max(-5, 70) -> A
7 * (5 > A: 1; 2) -> B

Markers and goto()

$0               ... marker
I + 1 -> I       ... increment I
I < 10: goto(0)  ... loops 10 times

Complex Functions

degtorad(X) => X * (pi / 180)
sin(X) => degtorad(X) - (degtorad(X)^3 / 3!) + (degtorad(X)^5 / 5!) - (degtorad(X)^7 / 7!)
cos(X) => 1 - (sin(X)^2)
tan(X) => sin(X) / cos(X)
ln(X) => 2 * ((X-1) / (X+1) + (1/3) * ((X-1)/(X+1))^3 + (1/5) * ((X-1)/(X+1))^5 + (1/7) * ((X-1)/(X+1))^7 + (1/9) * ((X-1)/(X+1))^9) 
log(X) => ln(X) / ln(10)

Sets

{ 5, 6, sin(7), X } -> W
display(W_1) ... displays first index of set W '5'

Example Code

About

A programming language designed to look like math and be used like a calculator

Topics

Resources

Stars

Watchers

Forks

Languages