LDPL is a powerful compiled 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. LDPL was designed to run on Unix systems, including AMD-64 Linux, macOS, ARMv8 Linux, Android Termux 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 and other useful goodies.
- LDPL Philosophy
- How to Install LDPL
- Learning LDPL & Documentation
- How to use the LDPL Compiler
- LDPL Compatible Editors
- Contributing to the LDPL Project
- Supporting the LDPL Project
- Getting Help
📒 Example LDPL code
# Hello There Example data: name is text i is number procedure: display "Hello there, what's your name?" accept name for i from 0 to 10 step 1 do display "你好, " name "!" crlf repeat
This code greets the user and asks them to enter their name, then it greets them in Chinese, ten times. Easy as pie and super legible. Check the official website and the examples subfolder for more examples, including a Brainf*ck interpreter and Bellman-Ford's Algorithm!
🎏 What can I use LDPL for?
LDPL can be used to write software just like any other language you know. You can open, edit and save files, do math, parse and modify text, etc. Some of these tasks are made easier by the fact that LDPL natively knows how to work with UTF-8 strings. By using the available libraries, LDPL becomes a language specially well suited for writing Telegram Bots, IRC Bots, Text UI Applications and Simple Network Applications. Code written in LDPL is easy to read, runs fast and can easily interface with C++ code, so you can do anything you want, really.
📯 LDPL Philosophy
LDPL is a language designed to be easy to understand and simple to write. Designed to be easy to learn and simple to use. We believe that coding should be easy and simple. Nothing should become a frustrating chore. Compiling source code should be easy and simple: a single, flagless command should be enough to compile any source code. Every statement in the language should do one and one thing only, not multiple things depending on the context. Complex, low level stuff like encoding, sockets, floating point number comparison, etc., should be dealt by the compiler, transparently to the user. Hard stuff should be made easier.
We understand that this philosphy may lead to longer source code, more verbose statements and extra steps to reach an end, but we also believe that it should make coding in LDPL easier and more enjoyable than in other languages.
As one user once put it, "Usually when I'm programming, I feel like I'm in a big fancy jet and there's a lot of turbulence and it's not going well but then all of a sudden it's smooth air again and the drink cart comes along and I get a ginger ale and it's great. But with LDPL, I feel like I'm a cub scout out in the woods with a box of matches and a hatchet and my Scout's Handbook (the LDPL Docs) just exploring and figuring it out as I go. Whenever I run into a problem I just check my handbook and, sure enough, there's a solution right there waiting for me!".
We want to make LDPL a language you'll love not because it lets you do many things in one line, nor because of the way it runs, nor because of how modern it is: but because it's designed to stay by your side and tell you everything's gonna be okay even when times get dark.
💾 How to install LDPL
First, clone this repository. Then
make install. You can also optionally
make man to re-build the documentation (PHP is required for this). This will install LDPL and the LDPL documentation (
man ldpl) on your system. LDPL requires only C++11 to compile. LDPL will install some libraries to
/usr/local/lib/ldpl. If you want to install them in another location, modify the
LDPLLIBLOCATION variable of the (makefile)[makefile].
Once you have LDPL installed on your system, 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 in the sections below.
If you prefer Homebrew, you can install LDPL by running
brew install ldpl.
If you prefer Snap, you can install LDPL by running
snap install ldpl-lang.
📚 Learning LDPL and Read the Docs
The LDPL documentation is available here. Check that to learn yourself some LDPL (for the greater good!). The documentation is also uploaded to the docs folder of this repository and can be read and modified from there.
The LDPL documentation can also be found on your system using
man ldpl when you install LDPL by using
make install or the LDPL Install Wizard. The man page is also available in the man folder of this repository. If you download a precompiled LDPL binary, the man documentation is included as
ldpl.1, but you have to install it yourself.
💻 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, write some LDPL source code, for example
Then compile the source code using
ldpl source.ldpl. The compiled, executable binary file will be saved as
Done! For more information on the compiler run
ldpl -h and check the docs.
🔧 Compiler options
-fflag can be used to pass extra options to the compiler when building extensions. For example,
-f=-lSDLcould be used to link against SDL. The
flagstatement can also be used as well (
flag "-lSDL") and its use is recommended.
- 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 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.
- You can import extensions to your LDPL compilation by using the
-i=flag. Extensions can be imported by passing
.cppfiles to this flag; see the Extensions section below.
--versionprint out version info and release details.
--helpprint this list of options.
For more information, check the docs.
📦 C++ extensions
LDPL supports extensions written in C++. Extensions are
.a files that can be imported into your program using the
EXTENSION statement. For example
Libraries can be included using
include "library_name" # for example: include "std-math"
PROCEDURE sections of your source file.
📖 The LDPL Standard Library
A number of useful statements and subroutines are available in the LDPL Standard Library.
🦕 Other LDPL Libraries
- The LDPL IRC Bot Library: the LDPL IRC Bot Library lets you write LDPL programs that connect to IRC servers, join channels, send messages and more in the simplest way possible.
- The LDPL Ncurses Library: an ncurses wrapper for LDPL designed for creating terminal applications that require more complex text user-interfaces than simple line-feeding.
- The LDPL Network Server Library: the LDPL Network Server Library is an library for creating 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.
- The LDPL Socket Library: the LDPL socket Library allows you to open, close, write to, and read from network sockets in LDPL.
- The LDPL Telegram Bot Library: this simple LDPL library lets you create a Telegram bot that can receive and send text messages.
- The LDPL URL Resolver Library: a super easy to use library for LDPL that helps you resolve URLs into their respective IP addresses.
📝 LDPL Compatible Editors
We have highlighting and code formatting extensions available for Gedit / Pluma (by Lartu), Visual Studio Code (thanks to xvxx and Lartu), nano (by Lartu), Atom (thanks to Damián Garro) and Vim (thanks to Araml).
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 can I contribute to LDPL?
There are many ways to contribute to the LDPL project. You can fix bugs, add issues, write examples, write software in LDPL, add statements to the Standard Library, 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 LDPL Code of Conduct. TL;DR: be nice to everyone.
🦕 🦕 🦕 Community
If you want to talk to the rest of us, join the LDPL Mailing List! You can also find the LDPL community at r/LDPL, via IRC on irc.freenode.net, channel #ldpl, and 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.
👔 Supporting the LDPL Project
The LDPL Programming Language is a non-profit project mantained by people like you from all over the world. If you like what we do, please consider donating to the LDPL project.
There's also LDPL merchandise available, due to popular request! We've paired with TeePublic to bring you everything from shirts, to mousepads, to coffee mugs. All money made from selling these goodies goes to funding the language, paying for the server that keeps the LDPL website online, etc.
Visit the LDPL Donations and Merchandise page for more information.
🔎 Getting Help
If you have any questions regarding the LDPL project 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 no dumb questions, just ask away.
The LDPL Compiler is distributed under the Apache 2.0 License. All LDPL Dinosaur logos where created by Lartu and are released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license.