Prolix 1.1

From Esolang
Jump to navigation Jump to search
Prolix
Prolix-logo.png
Paradigm(s) Multi paradigm: object oriented, procedural (imperative), functional, structured
Designed by User:_morlus
Appeared in 2023
Dimensions One-dimensional
Computational class Unknown
Reference implementation Unimplemented
Influenced by Bash, sh, Batch, PowerShell
File extension(s) .prlx

This page now is only for Prolix 1.0+ and currently Prolix 2.0 is out so maybe you can check the original "Prolix" wiki page!

Prolix (/ˈprəʊ.lɪks/; meaning lengthy, too many words) is an esoteric programming language and is designed to be shell-based, making reading lines of code simple but it is quite lengthy to write a program.

Prolix is statically typed and garbage-collected. It supports many programming paradigms, including structured (especially procedural), object-oriented, and functional programming.

The programming language was created by @_morlus who posted the programming language creation process in Esolang's Discord server and the project was created in 2023.

Basic design concepts related features

Programming language Prolix supports several models. Many of its capabilities allow functional and aspect programming, while object-oriented and structured programming are completely supported. Extensions support many more models, such as logical programming and contract design.

For memory management, Prolix employs a cycle-detecting garbage collector in conjunction with static typing. The method and variable names are bound during program execution through the use of static name resolution, often known as late binding.

Moving speed-critical functions to extension modules written in languages like C can speed up execution, but this method only slightly increases speed (because Prolix is a very static language) or only compiles a restricted subset of Prolix, possibly changing semantics.

Syntax and semantics

Although Prolix is an esoteric programming language, it is thought to be simpler than other esoteric languages, hence it will be challenging to create a program using. Prolix decodes the code line by line and occasionally employs English terms as keywords (there is no facility to split code by semicolon).

Statements and control flow

  • The new statement, creates a new object by the name provided.
  • The edit statement, edits the keys (arguments) provided by the object.
  • The activate statement, activate (invoke) object is provided.
  • The copy statement, copies the key from the provided object and replaces the key with another provided object.
  • The end statement requires no arguments and ends the program immediately.
  • The repeat statement activates the object repeatedly the number of times provided. (Deprecated)
  • The require statement is used to add and run the library from the file provided from the path. Usually, to export objects from the provided file, you must use the export keyword of the file you want to import.
  • The export statement is used to extract user-objects or C libraries into Prolix Objects and to use it needs to be imported from another file with the require keyword.
  • The public statement is a form of edit but more advanced and only used for user-objects and C functions.
  • The private statement used for user-objects and C functions that target integration and special keys during object activation.
  • The key statement is considered most special when its use is to access keys from objects (like accessing values from self or this of modern languages now).

Prolix is a programming language that does not support creating variables or naming values, but storing variables or values through objects built into the language.

Built-in object Description Added to version
array Objects have special uses and are used to store array data (can be thought of as a list) and along with converting strings into arrays and other functions. 1.1
clause This is an object that means a proposition or condition and is used to solve math problems using simple signs such as addition, subtraction, multiplication and division, etc. Along with that, there are comparisons of two values such as greater than, less than, equal, not equal, etc. And not only used for calculation and if the value is correct, the object from the key target will be activated and vice versa. 1.0
count This is an object used to store integer values and has the ability to add to the value provided in the amount key. 1.0
decimal Is an object that only stores float numbers and does not incorporate any features. 1.0
delay Is an object that has the ability to interrupt the operation of the program for the period of time provided in the amount key. 1.0
float Used to convert the value data type of a string or an object's key value into a float data type. 1.0
garbagecollect This object provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, and set debugging options. Since the collector supplements the reference counting already used in Prolix, you can disable the collector if you are sure your program does not create reference cycles. Automatic collection can be disabled by setting key function to disable. To debug a leaking program call. 1.1
input Used to set user input from command prompt or shell. 1.0
int An object used to convert the data type of the provided value to an integer data type. 1.0
invoke This object is capable of running external objects through strings. It can also trigger itself if the supplied string is its name, which will create a recursion. 1.1
io Used for reading and editing files provided from the path in the source key. 1.0
keys This is an extremely useful object for newcomers as it has the effect of retrieving all the keys in the provided object (It can only give out keys that are typed as public while keys that are typed as private are completely prohibited from accessing). 1.1
load Used to run the Prolix program from the provided file and especially the provided file to run code with permissions to access pre-created objects from the main file. 1.0
loadlib Used to integrate and load the C library into the program to speed up resolution from functions in the library. This is an extremely special object when it cannot be used by statement edit because the value type provided to the object extracted from the function in the C library must be a C data type and there are a total of 19 C data types is built in. 1.0
loop Object is a replacement for the repeat statement but has new uses such as breaking the loop by adjusting the mode key value to break. 1.1
math A special object that stores mathematical operations and functions and has a total of 12 mathematical functions, 4 constants and 1 function without arguments. 1.0
object This is a special object that has the ability to create a user-object with custom keys using statement public and some special keys used with statement private. 1.0
output Used to output strings or values to the console or command prompt or shell, etc. 1.0
str Converts the provided data type to string data type. 1.0
strlib It is an object that has many functions to make it easier to modify strings, such as split, replace, sub and so on. 1.1
system It is an object that stores variables, interpreter and operating system information. To get it, you do not need to modify the key and then activate to get the result, you just need to access the key through the key name for example platform, version, objectcount, etc. 1.1
text Is an object that has no features and is only used to store string values. 1.0
thread This is a very special object and has the same use as the load object but it creates a new process (also known as a thread). It runs code at the same time as the main program and is only different from the object load that is, the running program does not have access to the objects made available from the main program that activated the thread object. 1.0
unicode This is an object used to convert a number into a letter according to the unicode table (or it can be called ASCII). 1.1

Typing

Prolix is a weak programming language in terms of value types when there are only 3 value types to interact with, so it does not support lists, dictionary or tables, etc.

There are 3 basic data types in Prolix: str, int, float. Int and float are two arithmetic data types and can often replace boolean or null. As for str, it supports the fact that a text value along with a string can be converted into a key value from the provided object name if the beginning of the string has a $ mark.

In the version 1.1, Prolix supports a new data type but not exactly a data type, it uses string to save as an array, for example when you create a new object, a private key in an accessed object named data is being stored with a C data type that is GArray from the external library of C is GLib.

Development environments

In some programming environments, Prolix has a built-in command line interpreter and to run a prolix file you usually just need to use the command:

prolix myfile.prlx

Programming examples

Hello world program

new output $output
edit output message "Hello, World!"
activate output
end

Extending Prolix with C

main.c:

#include <stdio.h>

int mult(int x, int y) {
    return x * y;
}

Turn file main.c into main.dll by using gcc

gcc -shared -o main.dll main.c

main.prlx:

new loadlib $load
edit load source main.dll
edit load key mult
activate load
private load x int 0
private load y int 1
private load _name str mult
export load
end

test.prlx:

require main.prlx
new mult $mult
public mult x c_int 5
public mult y c_int 7
activate mult
new count $count
copy mult _result count value
new output $output
edit output message $count
activate output
end

After run file test.prlx, expected output:

35

Prolix is growing increasingly intricate

Prolix's most recent update was 1.1 when Prolix added many new objects, but among them received key strings from an array because the object needed 2 or 3 keys and to avoid creating multiple keys for the object. Prolix uses string and the value is an array so that new objects can read and convert the string into an array and read each argument.

strlib example

new strlib $strlib
edit strlib function char
edit strlib value "['Hello, World!', 4]"
activate strlib

new output $output
copy strlib result output message
activate output
end

Expected output:

o

strlib example with array

new strlib $strlib
edit strlib function replace

new array $args
edit args function add
edit args value "Hello, World!"
activate args
edit args value "World"
activate args
edit args value "Prolix"
activate args
edit args function view
activate args

copy args result strlib value
activate strlib

new output $output
copy strlib result output message
activate output
end

Expected output:

Hello, Prolix!

Versions

1.1.0

  • Added new objects: array, garbagecollect, invoke, keys, loop, strlib, system and unicode
  • All exception error now easier to understand.
  • Removed repeat statement.
  • Fixed some software bugs.

1.0.0

  • This version is the first version of Prolix and unstable.

Want read more? Maybe you should join my discord server! Click me to join.