ALMFCPLIR

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

ALMFCPLIR (or A Langauge Made For making Cambridge Programming Language Into Reality) is a language with the sole purpose is for making CPL (the true first C) more popular (since acording to Wikipedia: The implementation did exist in 1970's, but the langauage never got popularity so it disappeared in the same decade), however this idea turned into a sort of *python-like language.

This is also the first time User:Ractangle actually took the advice from User:Ais523 on firstly planing the esolang and then writing the page about the language (although kinda)

Syntax

The langauge's syntax will be denoted from the "max" function found from the Wikipedia article:

Max(Items, ValueFunction) = value of
§ (Best, BestVal) = (NIL, -∞)
while Items do §
(Item, Val) = (Head(Items), ValueFunction(Head(Items)))
if Val > BestVal then (Best, BestVal) := (Item, Val)
Items := Rest(Items) ̸§
result is Best ̸§

Functions

The way you define "Standard" functions is slightly similar to Javascript defining one-liner functions:

f(p1, p2) > [ {} > {} ]

There are also other types of functions:

["Void" functions don't have arguments]
{void} > { {} > {} }

["Class" functions are "standard" functions but use other functions inside them (which can be used in code)]
f(p1, p2) > [ { e(p1) > [ {} > {} ] } > {} ]
f.e(1)

Variables/Command expressions

Variables are defined in the same way as you define a "Void" function (which allows you to define many variables with the same value):

{n1,n2} > {0}

Also fun fact: Variables and Command expressions are the same thing in terms of stricture.

A list of expressions are here:

print Prints the argument
input Fetches the user input into a variable from the argument (which makes it the only Command expression that can be outside of the main function)
main Makes the interpreter's starting point
void Placeholder, automatically set to the null in any type specified by it's argument

Comments

You can make comments by either using the classic C-Style comments, or use the square brackets with nothing behind it:

//1 liner
/*Multi liner*/
[Multi liner]

"Hello, world!" program

main > { print > {"Hello, world!"} }