Pteryx

From Esolang
Jump to navigation Jump to search

Pteryx is designed by PSTF.

In some language (in my memory, it was Ancient Greek), "Pteryx" means wings. The reason it was named Pteryx is because I hoped it could be as powerful as a lion(or tiger, as I'm Chinese) with wings.

Although it is still in the 0.0 beta version, it will become stronger in later versions. I might also form a development team.

The development codename of this programming language is 'Archangel Michael'.

Introduction

Pteryx, of course, is inspired from SLet 3(or 4), XENBLN, StormLang and APL.

Data types

In this programming language, we have defined 10 data types:

  1. Numbers. All numbers must be expressed in the form of decimals or fractions. The range of numbers is all real numbers. If it is an infinite non-repeating decimal, we use an ellipsis after 20 decimal places (but if a repeating cycle appears, it is considered an infinite repeating decimal).
  2. Complex numbers. Complex numbers are usually represented in the form a + bi, where a and b are real numbers. Note that 1i should not be confused with i.
  3. Documents. A document is equivalent to a string in other programming languages and is enclosed in quotes (supports escaping, and both single and double quotes are allowed). If enclosed in triple or sextuple quotes, it is considered a multi-line document or a document comment. F-documents also support embedded references (variables, constants, expressions, etc.) within the document, R-documents do not support escaping, and U-documents are UTF-8 encoded by default.
  4. List. A list supports storing multiple pieces of data.
  5. Ordered pair. An ordered pair consists of a first value and a second value, and can be used to represent complex numbers or other things. An ordered pair must be strictly expressed in the form (a, b).
  6. Set. A set can also store a series of data, but it automatically removes duplicates and sorts them.
  7. Logical values. Logical values are equivalent to boolean values in other programming languages.
  8. Function. More precisely, it should be called a 'lambda function'; it is a block of code, although we can give it parameters and a name.
  9. Dictionary. A dictionary is a list that stores key-value pairs.
  10. Struct. You can create your own data type.

In addition, we have an undefined type, and casting it to a string will result in 'fuck you'.

Command Tables

Control flow

if(a){b}else{c}      : If expression A returns true, execute function B; otherwise, execute function C.
for(i, v){b}         : For every i contained in v, execute code b.
while(a){b}          : Repeat b continuously until the expression a is not satisfied.
call(k, l)           : Execute code k with all elements in l as arguments 
                       (l may be a dictionary, which will result in keyword arguments). 
                       Leaving l empty means no arguments.

I/O

print a, b, c...     : Output a series of specified data to the designated output file (default is CON, which is the current console).
input                : User's input.
getch                : Get a character.
putch                : Output a character.
getLn                : Get a line.

Processing

match a, b           : Form an ordered pair with a as the first element and b as the second element.
unite                : Package all the elements located between 'unite' and 'end' into a set.
flip                 : For strings and lists, reverse them.
                       For real numbers, take their opposite.
                       For complex numbers, take their conjugate.
                       For a logical value or a conditional expression, 
                       perform a logical NOT operation on the resulting value.
swap                 : For a pair of numbers, swap the positions of the two values.
                       For two specific addresses, swap the values they point to.
                       For real numbers, take their reciprocal. 
                       Swapping 0/1 or 0/x(where x is an integer) will cause a MathError.
first                : For a pair of numbers, return the first one.
                       For a real number, if it is rational, output its numerator; otherwise, raise a value error.
second               : For a pair of numbers, return the second one.
                       For a real number, if it is rational, output its denominaator; otherwise, raise a value error.
append               : Add A to the tail of the list.
insert               : Insert element a at position x in the list (starting from 0), then move the elements after a one position back.
random               : For a list, randomly select an element. 
                       For a pair of numbers and an integer, 
                       arrange them in order from smaller to larger, 
                       and then randomly select a real number with precision x between these two numbers.
intersection         : Returns A∩B.
union                : Returns A∪B.
range                : Just range, same as in Python, results in a set.
length               : For a set, list, or string, return the number of elements it contains.
                       For a complex number, convert it to a point on the complex plane, 
                       and then calculate the distance from that point to the origin.
                       For ordered pairs, they are treated as complex numbers, 
                       with the former being the real part and the latter being the imaginary part.
declare              : Declare an uninitialized and unavailable variable.
open                 : Enable the specified variable. Variables that are not enabled cannot be used.
close                : Disable the specified variable. It can still be enabled afterward.
abandon              : Completely disable the specified variable. It cannot be enabled until it is declared again.
push                 : Push the specified value onto the stack.
pop                  : Pop the top element from the stack and return it.
filtrate(i, v, c){b} : For all i contained in v, b is executed only if condition c is met.
bye                  : Exit the program immediately and return error code 0.
nop                  : Literally a NOP.
break                : Jump out from the cycle.
continue             : Jump to the next round of the cycle.

Constants

NULL                 : An empty value.
True                 : Logical 1.
False                : Logical 0.
NaN                  : Not a number.
inf                  : ±∞.

Interesting thing about Pteryx

This is the first programming language created by the author of PSTF that has a mascot.

Its mascot is a 14-year-old boy in a white upper-clothes, crimson trousers, black shoes, yellow-red jacket, and with a wing at his back.

So, how many languages did PSTF actually create based on SLet (Old 3)?

Example

Not yet.

Categories and References