Skip to content
/ ldpl Public

COBOL-like programming language that compiles to C++. With serious dinosaurs with neckties and briefcases 🦕💼

License

Notifications You must be signed in to change notification settings

Lartu/ldpl

Repository files navigation



LDPL is a powerful, general-purpose compiled programming language designed from the ground up to be excessively expressive, readable, fast and easy to learn. It mimics plain English, inspired by the best aspects of older programming languages like COBOL and FoxPRO. It even supports UTF-8 out of the box.

This repository contains the source code and releases of the LDPL compiler.

Example 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.

LDPL supports multiple datatypes and programming patterns. It is a full-fledged programming language. Check the documentation for more information, and the official website to see other examples, including a BF interpreter and Bellman-Ford's Algorithm!

LDPL Philosophy

LDPL is a language designed to be easy to understand, learn, write, and use. We believe coding should be like that. Compiling code should be effortless and straightforward: a single, flagless command should be enough to compile any source. Every statement in the language should perform one, and only one, function, independent of the context. The compiler should handle complex, low-level tasks like encoding, sockets, floating-point number comparison, etc., transparently to the user. Difficult things shouldn’t feel difficult.

We understand that this philosophy may result in longer source code, more verbose statements, and additional steps to reach a solution, but it aims to make coding in LDPL easier and more enjoyable than in other languages.

As one user once said:

"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 LDPL to be a language you’ll love — not because it lets you do many things in one line or because it’s modern, but because it’s designed to stay by your side and reassure you that everything will be okay, even when things look rough.

Installing LDPL

To install LDPL, clone this repository, navigate to the cloned directory, open a terminal, and run make followed by make install. That's it!

You can also optionally run make man to re-build the man documentation (PHP is required for this). This process will install LDPL and its documentation (man ldpl) on your system. LDPL only requires C++11 to compile and run.

Alternative Installation Methods

Bear in mind that these other installation methods may install an outdated version of LDPL, as they are maintained by external contributors. Make sure that the version you are about to install matches the last LDPL release.

  • 🍺 Homebrew: If you prefer Homebrew, you can install LDPL by running brew install ldpl.
  • 🐦 Snap: If you prefer Snap, you can install LDPL by running snap install ldpl-lang.

Learning LDPL and Read the Docs

Learning Dinosaur

If you want to learn how to code in LDPL, there is a brief tutorial available at https://learnxinyminutes.com/docs/ldpl. Additionally, be sure to check out the examples on the official LDPL website.

The LDPL Documentation is available here. 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 using make install. The man page is also available in the man folder of this repository.

How to use this compiler

To use the compiler, you must have a C++ compiler installed on your system and ensure it is accessible as c++ in your PATH. The LDPL compiler translates LDPL code into C++ code, making this a necessary requirement for it to function.

Once the compiler is set up, write some LDPL source code — for example, source.ldpl. Then, compile the source code using ldpl source.ldpl. The compiled executable binary will be saved as source-bin. For more information about the compiler, run ldpl -h or refer to the docs.

C++ extensions

LDPL supports extensions written in C++. Extensions are .cpp, .o, or .a files that can be imported into your program.

For a guide on writing and building C++ extensions, refer to the LDPL Docs.

How can I contribute to LDPL?

Contributing Dinosaur

There are many ways to contribute to the LDPL project. You can fix bugs, open issues, write examples, develop software in LDPL, and more. Check the contribution guide for details. Almost any contribution is welcome — even simply telling your friends about LDPL is an easy and valuable way to help.

Contributors are expected to adhere to the LDPL Code of Conduct. In short: be nice to everyone.

Community

If you’d like to chat with us, join the LDPL community in the LDPL Programming Language Telegram Group! There's also r/LDPL on Reddit.

You are also welcome to create new LDPL channels on any other platform.

Merchandise

Due to popular demand, LDPL merchandise is available. We’ve partnered with TeePublic to offer a variety of items, from shirts and mousepads to coffee mugs.

Getting Help

f you have any questions about the LDPL project, feel free to submit an issue in this repository, visit the LDPL website or join the community channels mentioned in the previous section. Remember, there are no dumb questions — just ask!

📜 License

The LDPL Compiler is distributed under the Apache 2.0 License. All LDPL Dinosaur logos were created by Lartu and are released under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.