Introducing Plick

Monday, Dec 11, 2023

One of the few things I enjoy is writing code with my grandfather. While C# has been his bread and butter for many years, he tells me stories of learning to program at Naval Postgraduate School, where they taught him an at-the-time new language called PL/1. It was the perfect language to him, and every time he mentions it I see the excitement on his face. I looked to set up a PL/1 compiler on his machine only to find that there are none available. While PL/1 is remembered by its influencees such as SQL, there really is no solution for anyone like my grandfather looking to write some PL/1.

Plick is a LLVM frontend which converts a dialect of PL/1 code called Micro PL/1 into LLVM IR. This LLVM IR is converted into a modern object file which the user can link into an executable. Because Plick uses LLVM (like Clang and Rust), Plick can target most modern architectures and operating systems. I have tested it and produced working binaries for Windows and Debian, with both the GNU toolchain and MSVC.

Features

  • 3 types, Fixed Decimals, Float Decimals, and Character(size), the PL/1 string type.
  • Functions
  • List based IO to standard input and standard output
  • These operators: + , -, *, /, =, **, NOT, AND
  • IF then, if then do, if then do else do,
  • Labels and goto

Plick is still a new project. Things may change (drastically), there are bugs, and there are still many more features to be added. A lot of the development time has been simply implementing PL/1’s non-IEEE-standard data types.

Sample code:

AVER:   PROCEDURE OPTIONS (MAIN);

		GET LIST(A,B,C,D,E);
        MEAN =  (A+B+C+D+E)/5;
        PUT LIST('AVERAGE IS: ', MEAN);
end;

This program will wait for the user to type in five numbers and will print out the average.

HELLO:   PROCEDURE OPTIONS (MAIN);
				
    DECLARE X CHAR(20);
    DECLARE Y CHAR(20);
    DECLARE Z CHAR(20);
    GET LIST(X,Y,Z);
    PUT LIST(' Printing X: ',
    X,
    ' Printing Y: ',
    Y,
    ' Printing Z: ',
    Z,
    'Exiting...',
    );
END;

This program will wait for three strings (surrounded by single quotes) to be entered into standard input, and will print them.

These are just some basic samples. More programs can be found in the test_pli_files directory or in integration_tests.rs.

Go back to Blog