JMPL Devlog #1
First Steps
June 30th 2025
Tags:
C
JMPL
Programming Language
The academic year has finally come to an end, so you know what that means: it's time to shift JMPL to a set theoretical programming language as part of my URSS (Undergraduate Research Support Scheme) project. For the uninformed, JMPL is my custom programming language that aims to have a syntax close to mathematics and use a 'set-theoretical' paradigm. Before starting my project, JMPL was on version v0.1.0, covering only basic features such as variables, functions, if statements and while loops. The syntax was rigid and C-like, using curly brackets for blocks and requiring sentences ending with semicolons. As this is not at all like proper mathematical syntax, I have spent the past week working on improving the syntax before I start implementing the set-theoretical elements of the language. Allow me to introduce JMPL v0.1.1, a stepping stone on the journey to set theoretical programming.
What's changed?
First of all, to support for mathematical operations, I've added the following native functions:
- pi() - returns a double approximation of π at 3.14159265358979323846
- max(x, y) - returns the largest of two numbers
- min(x, y) - returns the smallest of two numbers
- floor(x, y) - returns the floor of a decimal number
- ceil(x, y) - returns the ceiling of a decimal number
The built-in maths library is growing! Once I have most of the set features down, I will aim to massively expand this library but for now, it will do. Additionally, I fixed several floating-point errors to do with π and the trigonometric functions that were already included in the library:
- sin(n * pi()) will now return 0 for any integer n
- tan(n * pi()) will now return 0 for any integer n
- cos((2 * n - 1) * pi()) will now return 0 for any odd integer n
- tan(n * pi() / 2) will now return null for any integer n
Okay, now for what I spent the whole week working on:
Old Syntax
let i = 0;
while i < 10 do {
out i;
i := i + 1;
}
New Syntax
let i = 0
while i < 10 do
out i
i := i + 1
JMPL now supports optional semicolon statement separators and indentated code blocks! These features were never intended to be permanent, just a side-effect of following a C-like language implementation tutorial. However, the change was driven by the need for the curly brace to exclusively represent a set in future updates. Keeping curly braces as block indicators would've created ambiguity when parsing sets, so it was crucial to remove them. The use of indents is very similar to Python; statements in the same block must have the same number of spaces before them to be indented. We are now one step closer to mathematical syntax!
Finally, let me introduce the new mascot of JMPL: Jimp the Imp!
