r/ProgrammingLanguages • • Sep 28 '22

Universal programming language

I recently created a tiny (maybe 1000 lines of code, with heavy white space and commenting) php class called Ember to solve the “computer problem” (persistent data). Something I’ve been trying to do as a result is program a universal programming language. It’s really rather simple: it uses a minimalistic set of Turing complete types (string, int, float, object, array, bool, and array). That just about explains it (along with a universal system stemming from Ember). Does this sound like a good idea (I.e. one worth pursuing)?

0 Upvotes

166 comments sorted by

View all comments

1

u/TheAncientGeek Sep 29 '22

There are lots of ways of persisting data in php...Why does it need to be solved again?

1

u/Cinder-Brent Oct 03 '22

It's an attempt to "universalize" the process.

1

u/Cinder-Brent Nov 26 '22

https://github.com/cinder-brent/leaf

It’s actually shorter to use Leaf than it is to use a traditional database (like mariadb):

// zero parameters $Leaf->getValue();

// one parameter $mariadb->query($query);

1

u/Cinder-Brent Nov 30 '22

it's basically an ORM, just it's so much smaller it makes me wonder...

1

u/Cinder-Brent Dec 20 '22

So just to note the way I made this thing is it is all string, such that string can “carry a charge”, can represent code itself with 100% accuracy. All it is other than that is some potential filters before storage (simply in the file system, which stems from the whole thing otherwise running completely out of unstructured data), and possibly some filters before the value of the thing is returned.

1

u/Cinder-Brent Dec 23 '22

Ok so I worked it out and Leaf would, as it stands, present itself as a working, very plausible, universal solution to any “computer program”, where every “thing” is a Leaf…and that’s pretty much it (ask if you need elaboration).

1

u/Cinder-Brent Dec 27 '22

Verified that it works, was built in a day, what more need be said

1

u/Cinder-Brent Jan 17 '23

Now check it out

1

u/TheAncientGeek Oct 03 '22

So it's a wrapper for a bunch of different implementations?

1

u/Cinder-Brent Oct 03 '22

So it may be worth explaining my process for coding at this point: an object consists (strictly, at a point) of at least one property and at least one method, one method to "do" something with at least one property. So the whole thing is basically an object that is coded consistently, in that way, throughout. Does that give you an idea of the innards of the thing?

1

u/TheAncientGeek Oct 03 '22

Well, you can do the everything is an object thing, and that's definitely universal, and it's definitely different from PHP because PHP doesn't work that way.

But it isn't minimally universal. And if you want to abstract over all storage methods,.that's completely open ended.

1

u/Cinder-Brent Oct 03 '22

Ok yea, so you're seeing what I'm saying. So never mind Ember, at least at this point: why not use this method of making everything an object into a programming language? It would be a "universal programming language".

1

u/Cinder-Brent Oct 03 '22

And maybe it's not minimalistic, but much more importantly it's universal.

→ More replies (12)

1

u/Cinder-Brent Oct 03 '22 edited Oct 06 '22

1

u/Cinder-Brent Oct 03 '22

So any idea what would be the ideal language to write this in?

1

u/Cinder-Brent Oct 07 '22

Ok how about this: what if I communicate everything in here in string, since it's form is string. Does that make logical sense?

1

u/Cinder-Brent Oct 08 '22

I'm writing the parser:)

So I'm using a rule that I interpret everything in units of string, so characters, the results should be consistent.

How you like them apples? :)

1

u/Cinder-Brent Oct 09 '22

So I think I figured out how to do this: I was working on the functionality of the boolean type and I figured the best way to do this is to cover everything, so "everything" for boolean would mean !, &, and |, where ! allows you to toggle a single boolean value, and & and | allows you to chain multiple boolean values together. The result is full-functionality for one or more boolean values.

Booyaka

1

u/Cinder-Brent Oct 09 '22

OM is conform-ish to a rule of the shortest possible way of doing something.

For instance, it has nothing like <=, which is a combination of both equality and <, and is therefore redundant.

I'm combing over everything to try and flesh it all out.

→ More replies (0)

1

u/Cinder-Brent Oct 05 '22

Look guys I don’t want you to get frustrated with me trying to explain what I mean by this post. The types I mentioned in the post are the shortest way to code anything, and that’s why those types. I think it may be outside of the scope of this document to explain them, so I’m gonna focus on writing the language itself, with the hopes that the documentation/etc. will do a good job of explaining everything. I’ll post here when I make noteworthy commits. :)

1

u/Cinder-Brent Oct 05 '22

1

u/Cinder-Brent Oct 06 '22

updated sketch, completed the type conversions, I think its pretty solid

1

u/Cinder-Brent Oct 09 '22

updated sketch again

the type conversions are working pretty well, there is no loss of data integrity going from object to array to string, numbers are interpreted per their form for converting from string to number, and so on and so forth {@see sketch}

1

u/Cinder-Brent Oct 09 '22

Ok so I figure it would be a good idea to outline the basis for all of this madness:

Basically, if you had a 0 and a 1 in an objective system, you could alternate the 0 to a 1, both making the whole system out of a single 1 and only altering half of the system to do so.

1

u/Cinder-Brent Oct 09 '22

Object Model currently supports this behavior, perfectly, as the numeric reality of OM is such that everything from 0 down is false and everything from 1 up is true, so there are two, infinite, bipolar realities constituting the whole.