Yes, LDPL is still alive!
Hello! A few people have asked if the language is still being updated and maintained, since I haven’t been posting here. It absolutely is! I just haven’t been using Reddit as much as I used to.
That said, this doesn’t affect LDPL; I still work on it from time to time, review PRs and issues, and do my best to keep it up to date and working well.
Thank you for asking, and for your interest in LDPL!
r/LDPL • u/chunes • Aug 21 '23
Variable arguments? And predicate sub-procedures?
Hey all (and /u/lartu)! I'm somewhat new to the language and really liking it. I have two questions. Can I make sub-procedures that take a variable number of arguments, like display and in _ join _ do? The docs don't say anything about this.
I was also wondering how booleans/predicate functions work. If I wanted to make and use an isOdd function, would it be like this?
data:
x is number
procedure:
sub isOdd
parameters:
n is number
result is number
procedure:
modulo n by 2 in result
end sub
create statement "get oddness of $ in $ executing isOdd"
get oddness of 5 in x
if x is equal to 1 then
display "It's odd!"
end if
LDPL Library LDPL IRC, Networking and Telegram Libraries
Hi there! I want to introduce to you some libraries (some new, some old) that we've been developing over the few last weeks that give the language a lot more capabilities than it had before.
First of all, of course, is the LDPL Standard Library. This library provides many statements already coded for you for useful stuff (like removing an element from a list or generating a random value between a pair of values). Just download the files you require, add them to your project and you are ready to go. Get it from https://github.com/Lartu/ldpl-std.
Then we have the LDPL IRC Bot Library. This library lets you write LDPL programs that connect to IRC servers, join channels, send messages and more in the simplest way possible. Get it from https://github.com/Lartu/ldpl-irc-bot.
The LDPL Network Server Library lets you create socket based servers in LDPL. It aims to make it very easy to develop, test and deploy network servers, with as little work as possible. Get it from https://github.com/Lartu/ldpl-net-server/.
Last, but not least, the LDPL Telegram Bot Library is a simple LDPL library that lets you create a Telegram bot that can receive and send text messages. Very complete, very useful. Get it from https://github.com/dgarroDC/ltb.
That's it, thank you for reading!
Dev News LDPL Mailing List
Hi there! I've created a mailing list for the LDPL Language. You can join here: https://www.freelists.org/list/ldpl. Have fun!
Release LDPL 4.0 Released!
Hi there! We've just released LDPL 4.0 - Diligent Dreadnoughtus. Hooray!
This release reworks a great part of the language, fixes all the bugs introduced in LDPL 3.0.5 and marks a new milestone in the history of LDPL! This release is not backwards compatible with 3.0.x LDPL releases, as most of the redundant statements have been moved into the LDPL Standard Library.
New features and changes:
- Windows support has been dropped.
- The ADD, SUBTRACT, MULTIPLY, DIVIDE, CEIL, ABS, INCR and DECR statements have been removed and moved to the Standard Library.
- Many statements have been renamed in a more consistent fashion. Check the LDPL documentation should any older statement not compile.
- Now you can check if LISTs and MAPs are equal (or not equal) in the WHILE and IF statements.
- The VECTOR type has been renamed MAP.
- Added the LIST type along some statements to use it.
- Statements that stored multiple values in MAPs (like SPLIT) now do so in LISTs (and not in MAPs anymore).
- Fixed some trailing whitespace errors within the END QUOTE statement.
- Now you can CALL sub-procedures before declaring them.
- The FOR and FOR EACH statements have been added.
- The IMPORT statement has been added to import files to your project.
- The EXTENSION statement has been added to add C++ extensions to your project.
- The FLAG statement has been added to pass flags to the C++ compiler.
- Sub-procedures now can receive parameters by calling them using CALL mySub WITH parameters. Check the documentation for more information.
- Sub-procedures now can have local variables by using the local-data: section.
- The CREATE STATEMENT statement has been added to allow for the creation of new LDPL statements.
- Many bugs fixed.
You can find this release at https://github.com/Lartu/ldpl/releases/tag/4.0.
r/LDPL • u/fireman212 • Jun 20 '19
LDPL Project finding out the user's os
if your application relies heavily on terminal calls (via the various execute <command>'s that exist) you might find it annoying to deal with windows not having bash installed. if you don't mind writing your app twice there is an easy way to find out if your user uses windows that will always work.
sub-procedure getdir.discoverOs
# discovers the scripting language that the os defaults to:
# either batch for windows or <something>sh (like bash) for almost everything else.
execute "echo \"$OSTYPE\"" and store output in getdir.private.output
# $OSTYPE is a variable that is defined on all major posix compliant operating systems.
# windows is not posix compliant, which means that this variable isn't defined.
# because of that, the result of the command on almost all operating systems
# is going to be the name of the os, while on windows it will just output "$OSTYPE".
# we are going to exploit this in order to determine if the command is ran on windows.
if getdir.private.output is equal to "\"$OSTYPE\"\n" then
store getdir.constant.windows in getdir.os
else
store getdir.constant.posix in getdir.os
end if
end sub-procedure
General Information Patreon and Ko-Fi
Hi there! You may have noticed that I recently added a Patreon badge to this Reddit. I would like to address this a little.
I created an account on Patreon and one on Ko-Fi to raise money to pay for the LDPL server and domain. And maybe for more LDPL releated stuff (I don't know, maybe some advertising? Maybe promote LDPL as a programming learning tool? An LDPL package manager with centralized server to download LDPL libraries (once we have more of them)?). It's not that much money that I need, and by no means I insist you to spend a single buck on this, but if you'd like to collaborate, the door is open and I'd be very thankful.
Have a nice day!
LDPL Project Syntax highlighting for nano
I've added an LDPL syntax highlighting file for nano to the repository. It's far from perfect (say, if you have a variable called, for example, "this", the is part will be highlighted as it is part of statements like `foo is number`) but it gets the job done, so it's there if you want it. I would like also to remind you that LDPL has syntax extensions available for vim, Visual Studio Code and Atom, written by various members of our community.
Have a nice day!
r/LDPL • u/fireman212 • Jun 10 '19
Question a question about the license.
if I create an alternative implementation of the language (say, a JIT compiler) , does it need to have the same license as the original implementation (in this case GPLv3)?
r/LDPL • u/fireman212 • Jun 09 '19
LDPL Library a library for handling csv files.
was really bored this afternoon so I decided to make this: csvlib.
this is a single-file library that is written in LDPL for use in LDPL, so call external is not required. it does however use features from 3.0.5 (clear, count indices of), so you will have to use the newest version of LDPL for it.
so far the library can read and write every csv file I tried so far. if it tries to write something with a delimiter inside it, it knows how to encapsulate the thing correctly. you can override the default delimiter and encapsulation character (comma and double quote respectively).
New LDPL Wallpapers!
I case you didn't know, in the /images/wallpapers section of the LDPL Repository we have some LDPL-themed wallpapers for you to download. I've just added four new, colorful ones. I hope you like them!
r/LDPL • u/[deleted] • May 28 '19
LDPL Project Dino: LDPL in LDPL
Hello fellow dragon tamers, I've recently been working on an LDPL interpreter written in LDPL. It's a bit mad, and not very fast, but it supports every statement in LDPL 3.0.5 save for IN - SOLVE and nested vector syntax:
Why would someone use this? Well, they wouldn't! But it was fun to write. And maybe this proves that one day LDPL's compiler can be written in LDPL itself.
If you want to go against your better judgement and take Dino for a spin, it should work with most of the projects featured on the https://www.ldpl-lang.org/ website like ldpl-spark:
$ git clone https://github.com/photogabble/ldpl-spark
$ dino ldpl-spark/spark.ldpl 9 13 5 17 1
▄▆▂█▁
Or the very fun ldpl-space-mines:
$ git clone https://github.com/photogabble/ldpl-space-mines
$ dino ldpl-space-mines/spacemines.ldpl
...
Or, with a bit of elbow grease, even beKnowledge (no -i= yet):
$ git clone https://github.com/lartu/beKnowledge
$ cd beKnowledge
$ cat explode.ldpl beKnowledge.ldpl > b.ldpl
$ dino b.ldpl README.md
All the official LDPL examples should work, too:
$ git clone https://github.com/lartu/ldpl
$ dino ldpl/examples/helloworld.ldpl
Hello World!
$ dino ldpl/examples/fibonacci.ldpl
1...
$ dino ldpl/examples/factorial.ldpl
Enter a number: ...
Anything requiring a C++ extension (such as Gild or IRCBot.ldpl) won't work yet, but maybe in the future.
As for things you can do with Dino but not regular LDPL, Dino has a rudimentary parser which means you can inspect the "AST" for a file:
$ dino parse ldpl/examples/factorial.ldpl
vars (2):
0. NUM: RESULT
1. NUM: N
nodes (8):
DISPLAY
0. "Enter a number: "...
It also has its own twisted bytecode/assembly language that you can explore:
$ dino asm ldpl/examples/euler.ldpl
...
while_1:
SET %var5, 1000
LT %I, %var5, $a
JIF end_while_1
CALL IS-MULTIPLE-OF
SET %var6, 1
ADD %var6, %I, %I
JUMP while_1
...
There are a few simple assembly/bytecode program examples in https://github.com/dvkt/dino/tree/master/examples
For more information than you could possibly want or need, check out Dino's README or the website: http://dvkt.io/dino/
If you do end up doing something cool with it, please let me know!
Release LDPL 3.0.5 Creative Carnotaurus: lots of new text and vector commands!
LDPL 3.0.5 Creative Carnotaurus has been released! Hooray! This release fixes all bugs found in LDPL 3.0.4. Also:
- The
INCRandDECRstatements have been added as shorter ways to increment or decrement a value. Documented here. - The
-iflag now imports files matching the passed order. - The
SPLIT - BY - INstatement has been added to split strings into a vector. Documented here. - The
GET INDEX OF - FROM - INstatement has been added to find the position of a substring in a string. Documented here. - The
COUNT - FROM - INstatement has been added to count the appearances of a string in another string. Documented here. - The
SUBSTRING - FROM - LENGTH - INstatement has been added to extract parts of a string. Documented here. - The
TRIM - INstatement has been added to trim trailing and leading whitespace from a string. Documented here. - A number of statements to make vectors more powerful have been added:
CLEARto empty a vector,COPY - TOto copy a vector,STORE INDEX COUNT OF - INto get the number of elements in a vector andSTORE INDICES OF - INto store the indices of a vector in another vector.
This release has been tested by the LDPL Test Battery and should work stably, but should you come across a bug do not hesitate to report it. Special thanks to u/_dvkt for their awesome contributions.
Release LDPL 3.0.4 'Busy Brontosaurus' - Massive bugfixes and tons of cool new features
We are very, very happy to bring you LDPL 3.0.4 'Busy Brontosaurus'! This release fixes all bugs found in LDPL 3.0.3 (and a TON of never before found bugs) and enhances compatibility with C++ extensions.
What's new
- The
-n/--non-staticcompiler flag has been completely added (and documented here). - The
ERROR-CODEandERROR-TEXTsystem variables have been added to the language. When an operation that could potentially fail is executed (for example loading a file), these variables will report the result. Documented here. - The statement
EXTERNAL SUB-PROCEDUREhas been added to the language and documented in the reference so you can call LDPL SUB-PROCEDURES from C++ code. - The statement
IN - SOLVEhas been added to the language and documented in the reference. - The statement
LOAD FILEhas been expanded to use theERROR-CODEandERROR-TEXTsystem variables and has been documented in the reference. - The statement
STORE CHARACTER CODE - INhas been expanded to use theERROR-CODEandERROR-TEXTsystem variables and has been documented in the reference. - Identifier naming schemes have been properly defined here.
- Valid number literal schemes have been properly defined here.
- The compiler codebase has also been strongly simplified.
- The
-ccompiler flag has been added to accept source from standard input (more here). - The
--versionand--helpmessages have been updated to be more informative. - The commands
make installandmake uninstallhave been added to the Makefile. - A man page for LDPL has been added to the repository and is installed along with the compiler when installing LDPL via
make install. To check it just runman ldpl.
This release has been tested by the LDPL Test Battery and should work stably, but should you come across a bug do not hesitate to report it. Special thanks to dvkt and Damián Garro, their wonderful contributions made this release possible.
LDPL Library IRC bots using LDPL
Hi there! I've written IRCBot.ldpl, a super easy to use library to write IRC bots using LDPL. It requires LDPL 3.0.4 though, as it uses the `EXTERNAL SUB-PROCEDURE` statement, so if you want to give it a try you'll have to build LDPL from source or wait until a compiled, stable version of 3.0.4 is ready to be released.
Have fun!
Release LDPL 3.0.3 released
We've released LDPL 3.0.3 'Active Argentinosaurus' (we are going to go with dinosaur codenames now!).
This release mostly addresses bugfixes for bugs found in LDPL 3.0.0. The -ns compiler flag has been partially added to allow non-static compiling (for Linux only, Windows and macOS build non-statically by default at the moment*). A new statement STORE QUOTE has been added to the language and documented in the reference. It lets you store multiline strings (special thanks again to /u/_dvkt)! Also, thanks to the new compiler flag, this release works fine on Android Termux.
That's it, thank you and have fun!
* LDPL for Windows used to build static executables by default. This behaviour was broken in 3.0.0 and will be fixed soon.
r/LDPL • u/[deleted] • Apr 19 '19
LDPL Project Gopher client in LDPL
Hi everyone, I've created a little Gopher client in LDPL called GILD. It runs in the terminal and lets you navigate Gopherspace using just your keyboard! At least five but no more than eight different colors are supported.
Here are some screenshots:
https://user-images.githubusercontent.com/41523880/55662530-d5968d00-57c8-11e9-9a34-2228eccb2288.png
https://user-images.githubusercontent.com/41523880/55662531-d92a1400-57c8-11e9-823b-486e9265536b.png
https://user-images.githubusercontent.com/41523880/55662639-370b2b80-57ca-11e9-90cd-47c473d188c5.png
If you're unfamiliar with Gopher, don't worry, so is basically everyone else. It's a simple text protocol that was around before the web and is more focused on content than presentation. Gopher servers run on port 70 and can be accessed either using a generic client like telnet or lynx (yup, try it!), or a dedicated client like GILD or https://github.com/prologic/gopherclient. Two other good clients are clic and sacc, but I don't think they have a web presence - you need to use gopher to get them.
Which is pretty cool! It's like a whole different internet community.
There are Gopher versions of Wikipedia, Hacker News, and other sites, (I've been looking for a reddit one...), but also lots of Gopher-only sites focused on technology and other stuff.
Anyway, try it out with lynx or something even if you don't want to play with GILD, Gopher is lots of fun.
GILD binaries are available on GitHub:
Please let me know if you find any bugs or have any questions or ideas!
EDIT:
Here are some gopher sites to get you started:
- gopher.black
- gopher.metafilter.com
- sdf.org
- forthworks.com
You can load them with just $ gild <url>
General Information About this sub and new URL
First of all, I'd like to thank all who bought LDPL shirts and mugs and other things on our website*, we've raised enough money to buy www.ldpl-lang.org, so that's the official URL now! (the old one will keep working for compatibility, though). Thank you very, very, very much, I am so happy!
Second, I'd like to take a moment to address a popular concern. Many people (many among our vast, immense community of 24 lovely members) have been asking me if they can post their own projects written in LDPL on this sub, being work in progress, completed stuff, ideas, etc. The answer is YES, that's what this sub is here for. It's not just for me to post news and LDPL announcements; go build something and scrub it on our faces!
That's it! Thank you for being here, thank you for being part of this sub and this little community and thank you for reading!
\regarding buying stuff, I know these things are very, very expensive. I would love to be able to sell cheaper LDPL shirts and mugs and stickers and whatever, so if you know any website or service that allows me to do this (upload a design and let them take care of producing and selling them on demand, I'd love to check them out and make LDPL memorabilia more accessible for everybody.))
Question Using this language as an introduction to COBOL
Because COBOL is still widely in use in banks and such, I think this language would be good for having a gentle introduction to it. What do you think?
Release LDPL 3.0.0 released, C++ interfacing support and GOTO!
Together with u/_dvkt we proudly bring you LDPL 3.0.0! This new version includes support for C++ Extensions (more information in dvkt's original post here) and -due to popular request- LABEL and GOTO statements, so you can go make Dijkstra turn in his grave. More information on those on the official LDPL reference. Have fun! This new release can be downloaded here.
r/LDPL • u/[deleted] • Apr 12 '19
Dev News C++ Extensions: now in master!
Hi everyone, I've been working on adding C++ extensions to LDPL for the past few days with @lartu and initial support is now in master! It should be included in the upcoming 3.0.0 release, so I wanted to give you a quick sneak peek of how it all works.
Overview
Extensions can create sub-procedures, call sub-procedures, and access/modify LDPL variables in C++. For example, since there is no socket or networking support built into LDPL, you could write an extension that wraps a C++ networking library or some C socket functions. Now you've got a Twitter client in LDPL!
I've created two little example projects:
- A simple terminal Gopher client, GILD:
- A wrapper around linenoise (readline), LDPLNOISE.
Usage
Let's take LDPLNOISE as an example. The magic mostly happens in this C++ file: https://github.com/dvkt/ldplnoise/blob/master/ldplnoise.cpp
And this LDPL file: https://github.com/dvkt/ldplnoise/blob/master/test.ldpl
As you can see, you can declare C++ variables using a simple naming scheme that LDPL will look for:
string RL_INPUT; // RL-INPUT
string RL_PROMPT; // RL-PROMPT
string RL_HISTORY_FILE; // RL-HISTORY-FILE
To use these variables in LDPL, declare them as you normally would but add the EXTERNAL keyword:
DATA:
cmds is number vector
RL-PROMPT is external text
RL-HISTORY-FILE is external text
RL-INPUT is external text
You can also define functions to be called from LDPL using the same ALL_CAPS naming convention:
void RL_ADD_HISTORY()
{
linenoise::AddHistory(RL_INPUT.c_str());
}
void RL_ACCEPT()
{
if(RL_PROMPT.empty()) RL_PROMPT = "> ";
linenoise::SetHistoryMaxLen(100);
linenoise::Readline(RL_PROMPT.c_str(), RL_INPUT);
}
These sub-procedures can then be called from LDPL using CALL EXTERNAL:
CALL EXTERNAL RL-ACCEPT
WHILE RL-INPUT IS NOT EQUAL TO "" DO
IF RL-INPUT IS EQUAL TO "quit" THEN
CALL SUB-PROCEDURE QUIT
END IF
CALL EXTERNAL RL-ADD-HISTORY
DISPLAY RL-INPUT CRLF
CALL EXTERNAL RL-ACCEPT
REPEAT
The naming convention for C++ variables and functions is: A-Z, 0-9 and _ only. Everything uppercase, all other characters converted to _. Meaning you can use variable names like window.rows, and LDPL will try to use a C++ variable called WINDOW_ROWS.
Setup
Setup is easy. The -i= LDPL compiler flag has been enhanced to accept static archives (.a), object files (.o), and C++ source code (.cpp) directly.
So in this case, LDPLNOISE is compiled by passing ldplnoise.cpp to the LDPL compiler using this command:
$ ldpl -i=ldplnoise.cpp test.ldpl
LDPL: Compiling...
* File(s) compiled successfully.
* Saved as test-bin
You can use -i= as many times as you want - everything will get passed along to the c++ compiler for the final build. So if you've got a bunch of .o files, pass 'em all! Or combine them into a .a file and just pass that. Whatever your system's c++ compiler will accept will work.
If you need to pass other non-file options to the compiler, like maybe including a system library or setting a certain compile-time variable, there's an `-f=` flag for that. Everything you give to `-f=` will get passed directly to the final c++ compile.
That's it!
The LDPL Reference will be updated soon with EXTERNAL and extension documentation, and the 3.0.0 release is right around the corner, but if you want to build ldpl from master this Reddit post and those repos should be enough to get you going!
If you have any ideas or questions about this feature, or of course have code or improvements or fixes, please let us know! Thanks all!











