a^2 + b^2 = c^2 a = 3 b = 4 c | out
First clone and cd into this repo
$ pip install -e ./
$ judo example.judo 5.0
Currently it's closer to a solver.
Addition/Subtraction (+-), Multiplication (*/) and powers (^) are supported mathematical operators
Parenthesis are used to group math
var | out will spit out
var as output
Anything with more than one instance of a dependent variable in one expression is not currently suppored
Groups of expressions can be grouped together in a "scope"
These groups can be assigned to a variable, in which it acts like an object. Properties in that object can be accessed with a dot
pythagorian = :[ a^2 + b^2 = c^2 ]
These inner scopes can be combined with each other by putting them together
pythagorian~[ a = 3 b = 4 ]
This won't be very useful if a scope can not use information from the outer scope, so this
~ operator forces left-hand assignment, with access to outer variables
When these scopes combine, a new object is created that represents the scope's combined information. From this example, it will know enough to compute c, if asked for:
c = pythagorian~[ a = 3, b = 4 ].c c | out
$ judo pythagorian 5.0
If this were any other modern lanugage, this would seem clunky for a function call, so this leads to the next idea
Actually making this language fast.
A very basic version is working math with very tight restraints. No negative numbers allowed, nothing over 125 and a bunch of weird stuff. Mostly a proof of concept now, this should be getting a lot of my attention now.
Repo for VM here: https://git.kyleperik.com/kyle/judovm
A Linux binary is included here in
vm. To try a program with the vm, run
judo [file] --vm
Inner scopes bring a lot to the table already, but they are very specific. Other times there are situations where you would not want to compute something backwards. So functions are necessary for simple, one way operations
f = [a, b] => pythagorian~[a=a, b=b].c c = f[a, b]
Lists already exist. Without using a character before it, it will be simply a list. There are no nice ways of handling them or looping through them now.
l = [1, 2, 3]
The main difference bettween this and other logical programming lanuguages is the syntax. There will be minimal use of special characters. Essentially this will be a logical python.
Though this language is logical, I would like this to be thought as more as functional, with logical capabilities. I don't want this to revolve around solving puzzles or riddles. This is meant to add valuable capabilities to a useful programming language.