The polycarbonate language is a language I intend on working on after community college.
You may be asking... Why does this repo exist then? Why not create it after? Well, while I do intend on working on it
after communtiy college, I would still like to establish a historical specification for future me to follow. Polycarbonate is meant to be an esoteric language, and I intend on implementing it the OCaml programming language.
Variables in polycarbonate can only consist of singular letters. For example: a
, b
or greek letters such as α
, or β
. We will define a sample variable β
to bind β to the number three. This could be written as:
β = 0 + ... + 0 + 3 + 0 + ... + 0
(Yes, those infinite series of zeroes is required on both the left and the right hand side).
As of 9/30/24, we have allowed polycarbonate to express variables using the Hebrew alphabet. Meaning
שׁ = 0 + ... + 0 + 3 + 0 + ... + 0
is entirely valid.
In this example, 3
is defined as:
3 = 0 + ... + 0 + 1 + 2 + 0 + ... + 0
with 1
being defined as:
0 + ... + 0 + 1 + 0 + 0 + ... + 0
and 2
being defined as:
0 + ... + 0 + 1 + 1 + 0 + ... + 0
We then define both those 1's to be defined using our definition of 1
above.
This definition is required to be written in order for the reader to understand the concept of self-ref variables.
A builtin function is allowed to check the type of this:
α = t(β) # t(any) is therefore, a reserved function - and reserved functions cannot be overloaded or redfined.
A function looks simple. it can start with any letter, and may take any amount of arguments (im not THAT evil...). Functions names can be only one letter
Consider a function a(t), which represents the equation of a standard parabola with no transformations applied on it:
let a(t) ->
| r t^2
# Passing arguments is also simple:
α = a(3) # α is binded by the value of 9.
Here's how integration could be defined using these facts:
f(t) ->
| r t^2
i(x, n) ->
| r ((f(x) + f(x - 1/n)) / 2 * (1/n)) + i(x, n - 1))
Self ref variables can be understood by this example: we define b to be a variable bounded by 1.
b = 1
Now, to increment, a poor soul would do the following due to the lack of increment operators:
b = b + 1
This isn't doing what you expect it to do. What you instead wrote was:
b = 1
b = b + 1
b = (b + 1) + 1
b = (b + 1) + 1
b = (b + 1) + 1
...
Then, once you've obtained the amount of b
's that satisfy what b
's definition is. You must now expand however many instances of b
appeared into the expression itself.
Which is a total disaster.
This particular case expands to:
b = (((b + 1) + 1) + 1) + 1
b = (((b + 1) + 1) + 1) + 1
b = (((((b + 1) + 1) + 1) + 1) + 1)
b = ((((((b + 1) + 1) + 1) + 1) + 1) + 1)
b = (((((((b + 1) + 1) + 1) + 1) + 1) + 1) + 1)
b = ((((((((b + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1)
b = (((((((((b + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1)
b = ((((((((((b + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1)
b = (((((((((((b + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1)
b = ((((((((((((b + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1) + 1)
...
# and so on... and so forth...
How we approach "incrementing" a variable is unknown for now. Sorry!
Just like nature, things change. With the speed in which these changes will (or will not) occur being unknown. With nature, we define the beauty of languages as a half and half, with one half of a language being successful and the other half being a total failure. Both are okay! Hopefully, once I transfer from community college - I'd have met some other individuals who share a similar passion to this language, like I do. Do not expect the syntax to remain the same!