No Description

Kyle Perik a8aec4bb38 add logical operators 6 months ago
judo a8aec4bb38 add logical operators 6 months ago
.gitignore 7a0883991d update readme etc 1 year ago
bread.judo c0f905f867 modify bread example 7 months ago
example.judo 82f68f7eea organization, add readme, add pip setup 1 year ago
fact.judo 4fb7bb6c2c modify syntax, housekeeping 11 months ago
lists.judo 4fb7bb6c2c modify syntax, housekeeping 11 months ago
math.judo 4645e65ae6 add support for negative numbers 11 months ago
methods.md da156f22a5 add thoughts 1 year ago
readme.md 111aa90b31 basic bytecode 11 months ago
setup.py 82f68f7eea organization, add readme, add pip setup 1 year ago
vm 3137a9625d implement vm inner scopes basically 11 months ago
wages.judo 4fb7bb6c2c modify syntax, housekeeping 11 months ago

readme.md

Judo - simple logical programming language

example.judo

a^2 + b^2 = c^2
a = 3
b = 4
c | out

install

First clone and cd into this repo

$ pip install -e ./

try it

$ judo example.judo
5.0

Capabilies

Currently it's closer to a solver.

Syntax

Addition/Subtraction (+-), Multiplication (*/) and powers (^) are supported mathematical operators

Parenthesis are used to group math

Running 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

Inner scopes

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

Output

$ 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

Roadmap

VM

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

Functions

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

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]

Purpose

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.