Printscript

From Esolang
Jump to: navigation, search

Printscript is an esoteric programming language. It is inspired by Lua. This programming language supports the "print" function and many others.

Syntax

The syntax of the print function is:

print "some string"

Only ONE space should be put behind the "print" so that it will print as the programmer would expect.

Small secret: any character can substitute space, like printf"hello, world".

Note that Printscript supports multi-line strings like:

print "Line 1
Line 2
Line 3"

The output is:

Line 1
Line 2
Line 3

Multiple “print”'s are supported:

print "aaa
"print "bbb
"print "ccc"

Output:

aaa
bbb
ccc

If no spaces are added behind the "print", the output would skip the first character and print the rest of the characters if the string is not less than 2 characters.

A new characteristic is added in Version 2. It can print various unsupported characters using \. Example. print "print"

print "\p\r\i\n\t"

Output:

print

Example. Print a "

print "\""

Output:

"

Version 4 adds variable support.

Variables can only be one-char. However, it can be any char in the ASCII code.

Set: command used for setting a variable into a value

Example for setting a variable to char 3

set / 3
print /

Output:

3

Sev: command used for setting a variable into a variable.

Example:

set @ 2
print @
print "
"
sev % @
print %

Output:

2
2

Example Programs

Hello, world! program

print "Hello, world!"

This prints spaces until there is no enough space.

print"

or

print""

The programs above prints spaces until there is no more space for code.

How it works: The interpreter scans for the matching " while printing everything.

Version 3 fixes this problem. An error will print if the string is not matched.

print"

Output

Unfinished string.

Interpreter(in C)

Usage: ps your_program.ps

These programs are tested on Tiny C Compiler, but these not yet tested on other compilers.

Version 1 Version 2 Version 3 Version 4

See Also

Version 5 and later. Created because I forgot that I can use the pastebin.

Printscript 5 Printscript 9 Printscript 13