Skip to content

spiel0meister/mathy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mathy

A language meant for easy Math operations!

Quick Start

Clone the repo, and run:

cargo run -- <file-name>.mth

Syntax

In this language you can:

  1. Declare variables:
x = 2 * 5 + 1
y = x * 2
  1. Declare functions:
f(x) = x * 2
g(x, y) = x + 1 / y
  1. For-like loop--the from-to-as loop:
from 0 to 10 as x {
    # Stuff...
}

You can also use a custom step (defaults to 1.0):

from 0 to 10 as x with step 2 {
    # Stuff...
}
  1. Use lists and iterate over them with a for-in loop:
x = [1, 2, 3]
for y in x {
    y
}
  1. Print expressions:
f(x) = x * 2 - 2
from 0 to 10 as x {
    f(x) # The result will be printed out! btw this is a comment, this will be ignored
}

Todo

  • Built-in functions (sin, cos, tan, ...)
  • Constants (PI, TAU, GOLDEN RATIO, ...)
  • C-like macros to config interpretation (e.g. set angle mode to degrees, radian, or grad, ...)

Releases

No releases published

Packages

No packages published

Languages