Moka Documentation

Introduction

Moka is a multi-paradigm programming language and numeric computing environment created in 2022. Moka allows users to calculate mathematical equations, reference data, perform date calculations, and graph functions in a highly customizable environment.

All Moka actions are completed by calling a Moka Math Method (M3). All methods take 0, 1, or 2 arguments as input. Some M3 support other M3 to be an argument, and some M3 are allowed to be an argument. See full details in M3 table below.


Variables

Since all Moka actions are completed by calling an M3, variables cannot be created in the traditional "var x = 5" format. A variable must be created using the var() method. E.g. var(x,5)

Variables can also not be references directly. A variable must be referenced using the val() method. E.g. val(x)


Comments

All text after the final close parenthesis for the Moka command will be considered a comment. Parentheses are not allowed in Moka comments.

Use the c() method to create a full line comment. E.g. c() This is a comment.


Graphing

Graph Grid

Graph Grid is a feature in Moka that can be used to make lines along an axis to identify data point on a graph. There are a few Graph Grid attributes that can be set.

  1. xGG - x Graph Grid
    • Value is either "true" or "false"
    • Defalut value is "true"
    • If value is true, the Graph Grid along the x axis will show
    • If value is false, the Graph Grid along the x axis will not show
    • value can be set with xGG(bool)
  2. yGG - y Graph Grid
    • Value is either "true" or "false"
    • Defalut value is "true"
    • If value is true, the Graph Grid along the y axis will show
    • If value is false, the Graph Grid along the y axis will not show
    • Value can be set with yGG(bool)
  3. xGGI - x Graph Grid Increment
    • Value is a numeric value
    • Defalut value is 1
    • Increment for how far away each Graph Grid line is along the x axis
    • Value can be set with xGGI(x)
  4. yGGI - y Graph Grid Increment
    • Value is a numeric value
    • Defalut value is 1
    • Increment for how far away each Graph Grid line is along the y axis
    • Value can be set with yGGI(y)
  5. xGGMin
    • Value is a numeric value
    • Defalut value is 0
    • y value where the x Graph Grid lines should start
    • Value can be set with xGGMin(min) and xGGV(min,max)
  6. xGGMax
    • Value is a numeric value
    • Defalut value is .5
    • y value where the x Graph Grid lines should end
    • Value can be set with xGGMax(max) and xGGV(min,max)
  7. yGGMin
    • Value is a numeric value
    • Defalut value is 0
    • x value where the y Graph Grid lines should start
    • Value can be set with yGGMin(min) and yGGV(min,max)
  8. yGGMax
    • Value is a numeric value
    • Defalut value is .5
    • x value where the y Graph Grid lines should end
    • Value can be set with yGGMax(max) and yGGV(min,max)

Colors

Moka Math has 10 customizable color attributes. The colors can be set to any web color, and there are 19 preset themes to choose from.

* Attribute is only relevant when programming Moka, not Date Calculator pages
Preset Theme Background Text Method* Comment* Success* Error* Parenthesis* Comma* Input Background Input Text
Plain
Dark
Mocha
Black Coffee
Espresso
Red Eye
Black Eye
Latte
PS Latte
Sell
Shipley
Dr. D3
Mr. Monkey
RJ-45
Metalhead
DARTE
DARK-TE
Royalty
Deep Sea

Fonts

Font type and font size can be set by using Moka code. All standard web fonts and 19 Google Fonts are supported. Code examples:

# Moka m3 Return
1 moka>> setFontSize(25) m3>> font size set
2 moka>> setFont(Lato) m3>> font set

Google Fonts supported by Moka Math:

# Font Sample
1 Anton The quick brown fox jumps over the lazy dog
2 Arvo The quick brown fox jumps over the lazy dog
3 Bubbler One The quick brown fox jumps over the lazy dog
4 Jura The quick brown fox jumps over the lazy dog
5 Karla The quick brown fox jumps over the lazy dog
6 Lato The quick brown fox jumps over the lazy dog
7 Lora The quick brown fox jumps over the lazy dog
8 Monoton The quick brown fox jumps over the lazy dog
9 Mukta The quick brown fox jumps over the lazy dog
10 Neuton The quick brown fox jumps over the lazy dog
11 Orbitron The quick brown fox jumps over the lazy dog
12 Oxygen The quick brown fox jumps over the lazy dog
13 Poppins The quick brown fox jumps over the lazy dog
14 Righteous The quick brown fox jumps over the lazy dog
15 Roboto The quick brown fox jumps over the lazy dog
16 Rubik The quick brown fox jumps over the lazy dog
17 Spectral The quick brown fox jumps over the lazy dog
18 Ubuntu The quick brown fox jumps over the lazy dog
19 Wire One The quick brown fox jumps over the lazy dog

Moka Math Methods (m3)

Comparison
Method Description Argument(s) Returns Can Receive Method as Parameter Method can be Parameter
equals(x,y) Determines if two numeric values are equal Two parameters
  1. x - numeric value
  2. y - numeric value
x == y
(true/false)
Yes Yes
notEqual(x,y) Determines if two numeric values are not equal Two parameters
  1. x - numeric value
  2. y - numeric value
x != y
(true/false)
Yes Yes
gt(x,y) Determines if a numeric value is greater than another numeric value Two parameters
  1. x - numeric value
  2. y - numeric value
x > y
(true/false)
Yes Yes
lt(x,y) Determines if a numeric value is less than another numeric value Two parameters
  1. x - numeric value
  2. y - numeric value
x < y
(true/false)
Yes Yes
gtEquals(x,y) Determines if a numeric value is greater than or equal to another numeric value Two parameters
  1. x - numeric value
  2. y - numeric value
x >= y
(true/false)
Yes Yes
ltEquals(x,y) Determines if a numeric value is less than or equal to another numeric value Two parameters
  1. x - numeric value
  2. y - numeric value
x <= y
(true/false)
Yes Yes
Graphing
Method Description Argument(s) Returns Can Receive Method as Parameter Method can be Parameter
graph(function) Graphs function on 2D plain. Defaults
  • xMin = -10
  • xMax = 10
  • yMin = -10
  • yMax = 10
One parameter
  1. function - function in format of y=. graph() supports 'x' and 't' variables. E.g. graph(sin(x*t+t)*sin(x/3)*10)
Graph Yes No
xMin(x) Sets the graph value for xMin One parameter
  1. x - numeric value
void Yes No
xMax(x) Sets the graph value for xMax One parameter
  1. x - numeric value
void Yes No
yMin(y) Sets the graph value for yMin One parameter
  1. y - numeric value
void Yes No
yMax(y) Sets the graph value for yMax One parameter
  1. y - numeric value
void Yes No
xGG(bool) Turns x axis graph grid on (true) or off (false) One parameter
  1. bool - "true" or "false"
void Yes No
yGG(bool) Turns y axis graph grid on (true) or off (false) One parameter
  1. bool - "true" or "false"
void Yes No
xGGI(x) Sets x axis graph grid increment One parameter
  1. x - numeric value
void Yes No
yGGI(y) Sets y axis graph grid increment One parameter
  1. y - numeric value
void Yes No
xGGMin(min) Sets x axis graph grid minimum One parameter
  1. min - numeric value
void Yes No
xGGMax(max) Sets x axis graph grid maximum One parameter
  1. max - numeric value
void Yes No
xGGV(min,max) Sets x axis graph grid minimum and maximum Two parameters
  1. min - numeric value
  2. max - numeric value
void Yes No
yGGMin(min) Sets y axis graph grid minimum One parameter
  1. min - numeric value
void Yes No
yGGMax(max) Sets y axis graph grid maximum One parameter
  1. max - numeric value
void Yes No
yGGV(min,max) Sets y axis graph grid minimum and maximum Two parameters
  1. min - numeric value
  2. max - numeric value
void Yes No
Math
Method Description Argument(s) Returns Can Receive Method as Parameter Method can be Parameter
add(x,y) Adds two numeric values together Two parameters
  1. x - numeric value
  2. y - numeric value
x+y Yes Yes
sub(x,y) Subtracts two numeric values together Two parameters
  1. x - numeric value
  2. y - numeric value
x-y Yes Yes
mult(x,y) Multiplies two numeric values together Two parameters
  1. x - numeric value
  2. y - numeric value
x*y Yes Yes
div(x,y) Divides two numeric values together Two parameters
  1. x - numeric value
  2. y - numeric value
x/y Yes Yes
pow(x,y) Calculates a numeric value to the power of a numeric value Two parameters
  1. x - numeric value
  2. y - numeric value
x^y Yes Yes
calc(calculation) Calculates a mathematical calculation One parameter
  1. calculation - can include numbers, +, -, *, /, (, )
Mathematical answer Yes Yes
Formatting
Method Description Argument(s) Returns Can Receive Method as Parameter Method can be Parameter
setBgColor(color) Sets background color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setColor(color) Sets text color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setModColor(color) Sets module color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setComColor(color) Sets comment color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setSucColor(color) Sets success color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setErColor(color) Sets error color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setParColor(color) Sets parenthesis color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setCommaColor(color) Sets comma color One parameter
  1. color - hex value (e.g. #0a17eb) or CSS color name (e.g. red)
void Yes No
setFont(font) Sets font type One parameter
  1. font - name of font
void Yes No
setFontSize(size) Sets font size One parameter
  1. size - numeric value
void Yes No
c() Null method to take full line as a comment No arguments void No No
Variable
Method Description Argument(s) Returns Can Receive Method as Parameter Method can be Parameter
val(name) Gets variable value One parameter
  1. name - name of variable
Variable value Yes Yes
var(name,val) Creates variable Two parameters
  1. name - name of variable
  2. val - value of variable
void Yes No

Sample Code

# Moka m3 Return
1 moka>> c()Full line comment. We will calculate the total number of color combinations Moka Math offers. m3>> comment created
2 moka>> var(hexValues,16) a hex value can be 0-9 and A-F for a total of 16 different values m3>> variable created
3 moka>> var(hexDigits,6) there are 6 hex digits that make up a web color m3>> variable created
4 moka>> var(webColors,pow(val(hexValues),val(hexDigits))) calculate total colors supported on the web m3>> variable created
5 moka>> val(webColors) see answer to previous calculation m3>> 16777216
6 moka>> var(options,10) Moka Math provides 10 different customizable color options m3>> variable created
7 moka>> var(totalCombinations,pow(val(webColors),val(options))) m3>> variable created
8 moka>> val(totalCombinations) see answer to previous calculation m3>> 1.7668470647784E+72
9 moka>> c()This calculation could also be completed in one line without any variables. m3>> comment created
10 moka>> pow(pow(16,6),10) m3>> 1.7668470647784E+72

Future Work