JMPL Devlog #5

A New Set of Tools

August 3rd 2025

Tags:

C

JMPL

Programming Language


After a week's break, I am back with another JMPL update. This week I've been working on the final features for v0.2.1, focusing on creating some helpful syntactic sugar features, major optimisations, and bug fixes.

What's changed?

This week's major feature is quantifiers. Quantifiers are a way of easily querying sets, very similar to set-builder notation. This feature is taken from the idea of the quantifier from first-order logic. One of the key design philosophies of JMPL is aiming to translate mathematical ideas into programming. Therefore, as with set-builder notation, the syntax for quantifiers in JMPL is almost identical to its mathematical definition.

quantifier variable ∈ set, predicate

In JMPL, there are 3 types of quantifier: universal (∀), existential (∃), and choice. These quantifiers are notated respectively by: forall (∀), exists (∃), and some. As with all JMPL syntax, the '∈' symbol can be replaced with the 'in' keyword and the quantifiers with symbols can be replaced with those too.

Edit: I now plan to change the comma to a pipe (|) for consistency.

Universal Quantifier

The universal quantifier, interpreted as 'for all', is true for any predicate that satisfies all members of a set. In JMPL, it is an expression that returns a boolean value.

let S = {1, 2, 3, 4, 5}

∀x ∈ S, x < 5 // false

∀x ∈ S, x > 0 // true

This is syntactic sugar for the following:

let res = true

for x ∈ S do

    if ¬P(x) then res := false

Existential Quantifier

The existential quantifier, interpreted as 'there exists', is true for any predicate that satisfies at least one member of a set. In JMPL, it is an expression that returns a boolean value.

let S = {1, 2, 3, 4, 5}

∃x ∈ S, x < 5 // true

∃x ∈ S, x > 6 // false

This is syntactic sugar for the following:

let res = false

for x ∈ S do

    if P(x) then res := true

Choice Quantifier

As far as I know, this is not a standard mathematical quantifier. In JMPL, the choice quantifier acts as the existential equivalent of set-builder notation. The choice quantifier returns the first member that satisfies a given predicate, or null if otherwise.

let S = {1, 2, 3, 4, 5}

some x ∈ S, x < 5 // 1

some x ∈ S, x > 0 // null

Unlike the other quantifiers, there is no designated symbol for this operation, and I am hesitant to choose one. This operation can be found in epsilon calculus notated by the 'ϵ' operator. However, this is a valid identifier in JMPL, and is often used to represent an arbitrarily small positive number. Not using a symbol does create some inconsistency but I will work on the design of this quantifier more. Additionally, this operation is deterministic, which will need to change in the future.

Just as I did last time, I will now run through the other changes, fixes, and optimisations I worked on.

Bug fixes and optimisations:

  • Fixed errors with some keywords
  • Fixed interned strings not being garbage collected
  • Fixed large sets being garbage collected while being created
  • Optimised set and internal hash table access times
  • Optimised value storage using NaN boxing

Changes:
  • The keyword 'out' that prints text to the console has been removed in favour of the functions 'println' and 'print'. Earlier code examples won't be changed but keep this in mind.

Additions:
  • 1-tuples can now be created the same way as in python - with '(x,)' where x is a value.

Finally, I have published an extension for VS Code that adds lots of helpful features for working with JMPL. You can find it by searching 'JMPL' in the extensions tab in VS Code or here.

What's next?

My main focus for JMPL v0.2.2 is fixes and optimisations. This will include a string refactor, inclusion of special map sets, and optimising the omission operation. Additionally, I will also be working on the core design of JMPL - making sure its as set-theoretic as possible and ensuring consistency and robustness.

© 2025 Joel Luckett. All rights reserved.