Priml (pronounced 'primal') is a new programming language aimed at facilitating systems and AI infrastructure development.
The design of the Priml language draws inspiration from C++, Rust, and Swift. Personally, I hold Rust and Swift in high regard as excellent programming languages, while my relationship with C++ is more of a love-hate one (you can read my C++ rant). Many of us who were C programmers decades ago initially viewed C++ as "C with classes". While there have been some positive developments, C++ has largely declined. Under guidance of C++ elitists and standards committees, the language has become incredibly complex and error-prone, and useful features for safety, security, or package management have not been added. To this day, there is no % format specifier available for printing strings in C++.
"Speaking of languages, it's time to halt starting any new projects in C/C++ and use Rust for those scenarios where a non-GC language is required. For the sake of security and reliability. the industry should declare those languages as deprecated" -- Mark Russinovich
Mark's advice is valid, but abandoning C/C++ means losing valuable core concepts. While Rust is an excellent language, it introduces many new concepts, restrictions, and unusual syntax.
Imagine a language that could preserve the good core concepts of C/C++, exclude the bad elements, incorporate the best features of Rust/Swift, and present an incredibly simple and clean syntax that is easy to learn. That is the design of Priml.
Building the compiler requires a few dependencies. They are listed here with instructions on how to install on Linux and Windows:
After installing the dependencies, you can build the compiler from the source code. Following scripts are provided to make it easy to build and install the compiler.
Scripts | |
---|---|
cm.sh cm.cmd | Configures the CMake files to build using Ninja and CLang. Only need to run once |
bld.sh bld.cmd | Builds the compiler and tests. Can specify 'Debug' (default), 'Release', 'RelWithDebInfo' or 'MinSizeRel' |
install.sh install.cmd | Installs the compiler. Must be run from "Administrative" prompt |
git clone https://github.com/primllang/pc.git
cd pc
script\cm.cmd
script\bld.cmd
script\install.cmd
git clone https://github.com/primllang/pc.git
cd pc
chmod +x script/*.sh
script/cm.sh
script/bld.sh
script/install.sh
See usage:
pc -?
Usage:
new <unit> [--exe or --lib] [--nogit]
build [<unit>] [<build type>]
run [<unit>] [<build type>]
clean <units> ...
Build types:
--debug
--release
--relwithdeb
Other options:
--verbose
--cleanfirst
--hard
--checkdeps
--diagfiles
--savetemps
--config <configfile>
-?, --help
Create a new executable unit and initialize the git repo (default):
pc new --exe myexe
Create a new library unit with without git:
pc new --lib mylib --nogit
Build a unit by specifying the name of the directory where the unit is stored. If the directory is ommited, current directory is used. By default this builds the debug build type:
pc build myexe
Build a release build:
pc build myexe --release
Run the release build type of an executable unit using pc tool.
pc run myexe --release
Each unit has a yaml file that describes the unit, source files and dependencies, and extended libraries written in cpp.
unit:
name: helloworld
type: exe
version: 0.1.1
edition: 2023
src:
- main.pc
deps:
- base:
namespace: global
ext: