The LDPL Programming Language
LDPL is a very simple (but powerful) programming language designed from the ground up to be excessively expressive, readable, fast and easy to learn. It mimics plain English, in the likeness of the good parts of older programming languages like COBOL, with the desire that it can be understood by anybody. It's very portable and runs on a plethora of different architectures and operating systems including AMD-64 Linux, Windows and macOS, ARMv8 Linux, Android and both Intel and PowerPC OS X (tested from Tiger 10.4 onwards). It even supports UTF-8 out of the box.
This repository contains the source code and releases of the LDPL compiler. Check https://www.ldpl-lang.org/ for more information on the language, tutorials, examples and more!
Example LDPL code
data: name is text # Your name goes here! procedure: display "Hello World" crlf "What's your name? " accept name display "你好, " name "! Welcome to LDPL!" crlf
This greets the user, ask them for their name and then prints 你好, <name>! followed by a line-break. Easy as pie. Super legible. Check the official website and the examples subfolder for more examples.
You should first download or compile the LDPL compiler:
If you want to download a compiled binary: download the latest stable release available. You should then move the binary to a folder on your PATH.
If you want to build LDPL yourself: first, clone this repository. Then
make installLDPL in the
srcfolder. This will install LDPL and the LDPL documentation (
man ldpl) on your system. LDPL requires only C++11 to compile.
Note for Windows users: compilation under Windows has been tested with MinGW as installed on that guide. MinGW-w64 seems to have some problems compiling LDPL.
Also, it is advised to configure git autoclrf to use Unix-style end-of-line:
git config core.autocrlf input. LDPL relies on an AWK script which will not work properly with DOS-style newlines (CLRF).
Once you have LDPL installed, check the LDPL reference to learn how to use the language. Information on how to compile LDPL scripts and a list of LDPL compatible editors is provided below.
LDPL documentation & reference
The LDPL documentation is available here. Check that to learn yourself some LDPL (for the greater good)! The documentation is also uploaded to the ldpl-docs GitHub repository and can be read and forked from there.
The LDPL documentation can also be found on your system using
man ldpl when you install LDPL by using
make install. The man page is also
available in the man folder of this repository.
LDPL compatible editors
You can use any other editor (without syntax highlighting) if you like. If know how to write syntax packages for other editors and would like to contribute to the LDPL project, a highlighting extension would be a very welcome contribution.
How to use this compiler
To use the compiler, you must have a C++ compiler already installed on your system and have mapped it to
c++, found on your
PATH. The LDPL Compiler compiles LDPL code to C++ code and thus this is a requirement for it to work.
Once the compiler is set up, go write some LDPL source code, say
Then compile the source code using
ldpl source.lsc. The compiled, executable binary file will be saved as
Done! For more info on the compiler run
Example code can be found on the LDPL website.
- You can import files to your LDPL compilation by using the
-iflag. For example, say you have a library
mylib.ldpland a source file
mysource.ldpl, you can compile both and include the library by running
ldpl -i=mylibrary.ldpl mysource.ldpl. Multiple
-i=can be used to import multiple files. Extensions can be imported by passing
.cppfiles to this flag; see the Extensions section below.
-fflag can be used to pass extra options to the compiler when building extensions. For example,
-f=-lSDLcould be used to link against SDL.
- By using
-ryou can just compile the project and print the C++ representation for that code.
- You can set the output file for the compiled binary with the
-oflag. For example, if you want to name your program "dog", you could compile it with
ldpl -o=dog main.ldpl.
- On Linux and Windows platforms, LDPL builds static binaries by default. If you want to build non-static ones use the
-cflag tells LDPL to accept source code from the standard input.
--versionprint out version info and release details.
--helpprint this list of options.
LDPL supports extensions written in C++. Extensions are
.a files that can be imported into your program using the
-i= compiler flag.
How can I contribute to LDPL?
You can add statements to the language (that's in fact really easy!), fix bugs, add issues, write examples, write some software in LDPL, etc. Check out the contribution guide for more information. Anything is very welcome! Even telling your friends about LDPL is a very easy and very useful contribution!
Contributors are expected to behave by the Dragon Tamers Code.
If you want to talk to the rest of us, you can find the LDPL community at r/LDPL and via IRC on irc.freenode.net, channel #ldpl. Also on Telegram via the ldpllang group. The IRC and Telegram channels are bridged. You are welcome to open new LDPL channels anywhere else if you like.
Where can I get more help, if I need it?
You are welcome to submit an issue to this repository, check the LDPL website or join the community channels stated in the previous section. There are a few extra ways to get in touch with us stated on the website.
LDPL is distributed under the GNU General Public License 3.0. The LDPL Dragon logo is released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license.