dgarroDC / ldpl

Portable, COBOL inspired, compiled programming language, designed to be expressive, fast, readable and easy to learn.

Home Page:https://www.ldpl-lang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool



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. It's very portable and runs on a plethora of different architectures and operating 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, LPM (the LDPL Package Manager) and other useful goodies.

Index

πŸ“’ Example LDPL code

# Hello There Example
data: 
  name is number
  
procedure: 
  display "Hello there, what's your name?"
  accept name
  display "δ½ ε₯½, " name "!" crlf

This code greets the user and asks them to enter their name, then it greets them in Chinese. 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

Using the LDPL Install Wizard:

You can use the LDPL Install Wizard to make and install LDPL. This is the recommended install method, as it sets up everything LDPL needs for you and installs the latest LDPL version available. This method requires whiptail to be installed on your system (it probably is).

Just git clone this repository (or download it from here and un-zip it somewhere), open a terminal in it (or cd to it), run sh install.sh and follow the steps. Done!

By Yourself:

You can get yourself a precompiled LDPL binary or compile LDPL from source. Check the following table if you are not sure of what to do.

If you want to download a compiled binary If you want to build LDPL yourself
Compiled binaries contain the latest stable release. Might not be up to date with the newest, bleeding edge features, but will work fine on most systems and are already compiled for you. Building LDPL yourself gives you access to the latest features of the language. Development LDPL code tends to be stable, compile and work fine, but hidden bugs may still lurk in there!
How to: download the latest stable release available. You should then move the binary to a folder on your PATH. How to: first, clone this repository. Then make and make install LDPL in the src folder. This will install LDPL and the LDPL documentation (man ldpl) on your system. LDPL requires only C++11 to compile.

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.

πŸ“š Learning LDPL and Read the Docs

Learning Dinosaur

If you want to learn how to code in LDPL, there's a little tutorial at https://learnxinyminutes.com/docs/ldpl/. Also be sure to check the examples!

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 source.ldpl. Then compile the source code using ldpl source.ldpl. The compiled, executable binary file will be saved as source-bin. Done! For more information on the compiler run ldpl -h and check the docs.

πŸ”§ Compiler options

  • The -f flag can be used to pass extra options to the compiler when building extensions. For example, -f=-lSDL could be used to link against SDL. The flag statement can also be used as well (flag "-lSDL") and its use is recommended.
  • By using -r you 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 -o flag. 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 -ns flag.
  • The -c flag 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 .o, .a, or .cpp files to this flag; see the Extensions section below.
  • -v and --version print out version info and release details.
  • -h and --help print this list of options.

For more information, check the docs.

πŸ“¦ C++ extensions

LDPL supports extensions written in C++. Extensions are .cpp, .o, or .a files that can be imported into your program using the EXTENSION statement. For example extension "myLibrary.cpp".

For a guide to writing and building C++ extensions, see the LDPL official documentation. For a simple example, see the examples/cpp-extension directory.

πŸ› Libraries

LPM Logo

Starting from version 4.3, LDPL includes the LDPL Package Manager (LPM). When you install LDPL from source you also install LPM. If you download a pre-compiled binary, LPM is included in the same package. With LPM, downloading and using libraries (we also call them packages) is now easier than ever:

  • Run lpm info <library_name> to find information about a particular library.
    • Try, for example, lpm info std-math and lpm info ltb!
  • Run lpm install <library_name> to install a particular library.
  • Run lpm uninstall <library_name> to uninstall a particular library.
  • Run lpm count to display the number of installed packages.
  • Run lpm list to list all installed packages.

Once you've installed a library, you can include it to your project by just adding the line

using package <library_name> # for example: using package std-math

before the DATA and PROCEDURE sections of your source file.

Libraries not installed using LPM can be included using

include "library_name" # for example: include "std-math"

before the DATA and PROCEDURE sections of your source file.

πŸ“– The LDPL Standard Library

A number of useful statements and subroutines are available in the LDPL Standard Library. Just lpm install and include with using package the desired packages in your sourcecode and you are ready to go. For more information check the LDPL Standard Library repository.

πŸ¦• 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. Install with: lpm install ldpl_irc_bot.
  • 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. Install with: lpm install ldpl-ncurses.
  • 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. Install with: lpm install ldpl_net_server.
  • The LDPL Socket Library: the LDPL socket Library allows you to open, close, write to, and read from network sockets in LDPL. Install with: lpm install ldpl_socket.
  • The LDPL Telegram Bot Library: this simple LDPL library lets you create a Telegram bot that can receive and send text messages. Install with: lpm install ltb.
  • The LDPL URL Resolver Library: a super easy to use library for LDPL that helps you resolve URLs into their respective IP addresses. Install with: lpm install ldpl-url-resolver.

πŸ“ LDPL Compatible Editors

Gedit VSC VIM ATOM nano

We have highlighting and code formatting extensions available for Gedit / Pluma (by Lartu), Visual Studio Code (thanks to dvkt 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?

Contributing Dinosaur

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.

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.

πŸ‘” 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.

πŸ“œ License

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.

About

Portable, COBOL inspired, compiled programming language, designed to be expressive, fast, readable and easy to learn.

https://www.ldpl-lang.org/

License:Apache License 2.0


Languages

Language:C++ 94.2%Language:Shell 3.7%Language:Makefile 1.4%Language:Meson 0.7%Language:Awk 0.1%