r/ProgrammingLanguages • u/lartu • Mar 03 '19
I made a "programming language" based on COBOL syntax
First of all, I'm sorry. I'm deeply sorry.
A few months ago, talking with some friends, we had the idea of developing a programming language just for the sake of it. We talked a little about it, design by committee got out of control and, a few days later, we abandoned the project completely without having written a single line of code.
I, though, have wanted to make a programming language my whole life and thus I kept trying to push the project forward by myself. I created a syntax loosely based on that of COBOL, made the worst compiler possible, wrote a somewhat slow "virtual machine" and released LDPL as a joke. Even the name is a pun on older, business oriented languages with BIG-CAPITAL-LETTER-NAMES. Again, like COBOL.
Fast forward a little and the joke got out of control.
I kept working on the language on my free time - pushing the not-very-ortodox but easy to code compiler forward - and the language got pretty usable. I mean, it's not a language you'd like to work with. It can't do everything. It's quite slow. It doesn't have any scoping nor functions (it does have sub-procedures, though) nor lambdas nor objects nor fancy data structures. Think of it more of an esolang than a serious language.

But what it lacks in efficiency and features, it makes up by having a cute dinosaur logo (poorly drawn as a joke on other mascots like the GCC gnu), unicode support, a full standard, comprehensive documentation, fancy examples and a half-written tutorial to be finished in the next days. It's also very portable, with binaries available for Linux amd-64 and ARMv8, Windows 64 bits and even Mac OS X for PowerPC processors!
I'm sure you won't hate it that much.
Edit: thank you so much for the gold, the silver, the comments and the upvotes! This is now the highest voted post ever in this subreddit, I can't be more thankful and impressed. Thank you, thank you, thank you!
Edit 2: I've made an LDPL subreddit so if you are interested in talking about LDPL, coding some LDPL for fun and whatnot, come join us me at r/ldpl!
65
u/[deleted] Mar 03 '19
This is the greatest logo of any programming language. It got me to check out the language itself, and then I found this:
http://ldpl.lartu.net/reference/ldpl-reference.png
Definitely writing my next project in LDPL.
14
u/bones_and_love Mar 03 '19
What made you select COBOL's syntax as a model? Was it easier to write a compiler with it, or do you have a theoretical reason that you enjoy about COBOL syntax?
11
u/modrup Mar 03 '19 edited Mar 03 '19
that is far more readable than cobol.
next time make sure you start every line with a line number, then optional label (for your goto command) and follow a verb-noun syntax.
edit - the version of Cobol I used was forked off in the 1950s. I've no idea what modern things arrived later but I did find using those languages backed me into learning Assembler because they aren't particularly high level.
8
u/raiph Mar 03 '19
Only two posts have ever scored over 100 in this sub, both in the last 3 months. (17K subscribers!) The prior one was the rather serious sounding for anyone exploring Ξ»-calculus but I think this one takes the cake. :)
5
u/[deleted] Mar 03 '19
Wait a fucking second there. Do arrays in this thing START AT 1?
5
u/[deleted] Mar 04 '19
Remind me in 10 years when somehow this is the default language for everything.
3
u/killereks Mar 03 '19
How do you even start making own language?
3
u/eeeeeeeeeVaaaaaaaaa Mar 03 '19
I like the "is greater than or equal to" operator. It's very verbose
2
u/shevy-ruby Mar 04 '19
Here I thought COBOL would die, but no - people are doing a NEW VARIANT OF COBOL.
7
u/BluudLust Mar 03 '19
I'm sorry, but anything based on COBOL is an esoteric language.
4
u/macumbamacaca Mar 03 '19
You need to work on your sales pitch if you're going to sell this to management :-)
4
u/pembroke529 Mar 04 '19
Lots of COBOL still out there. In my last job, I helped to maintain a steaming pile of shit program (20k+ lines) written in COBOL. So many people had touched this program (maintenance), and the original programmer, who still worked there, was not the best coder.
I had hoped to be able to convert it to Python or Java.
1
u/erkus-circus Mar 03 '19
Where did you learn C++? I have been trying to find a good tutorial for months and canβt find one.
3
u/MCRusher hi Mar 03 '19
I like it. Closest thing I have is called CrapASM, which uses assembly-like syntax for an interpreted language. It also uses files as functions and doesn't support functions calling functions (because I sucked (I could fix it now but I don't care anymore) ). It had no if statement and used to only have an
equal Dest, V1, V2which nedded to be cleverly and mind-bendingly chained to be effective. It also uses spaces or commas to deliminate args, and supports backwards and general labels. backwards(;labelname) are registered when the interpreter encounters them, so they can only be used for jumping before the current command. General(:labelname) are registered when the interpreter starts and does a pass over the whole file and can be used before and after the current command.To declare a variable, you do
var NAME, VALUEand then it is created and initialized. Variables can contain pretty much any character, and can be plain numbers since the interpreter searches for matching var names before numeric literals. Sovar 1, 4is valid and now1is equal to 4 untilrem 1is used which deletes the variable. Also variables are not required to exist before a command is called, and there are no variable scopes.To make a basic if statement, you would do:
1
u/sp1jk3z Mar 03 '19
Hmmmm....
Not exactly what I'd do I suspect, I've a tonne of other priorities but more power to you for having done it.
You get an upvote even though I personally think it's silly!
π
2
u/[deleted] Mar 03 '19
I've worked in cobol for over 25 years. I understand it's no longer taught in American schools, but rest assured there is still a huge amount of cobol code being used in the financial sector. Not only is it being maintained there is also a lot of development. It is taught in Indian schools.
2
u/Tux1 Mar 03 '19
This looks pretty neat. It could probably be used as an introduction to COBOL, since there are still some jobs on the market that require the usage of it.
2
u/TotesMessenger Mar 04 '19 edited Mar 04 '19
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
Β If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)
0
u/[deleted] Mar 04 '19
[deleted] β view deleted comment
0
u/[deleted] Mar 04 '19
[deleted] β view deleted comment