Printscript 5

From Esolang
Jump to navigation Jump to search

Printscript 5 is invented by User:A.

New Syntax

Printscript Version 5 supports comments(both one-line and multi-line).

One line comment example:

-This is a one-line comment.
-print "asdf"
print "The previous 2 lines are skipped."

Output:

The previous 2 lines are skipped.

Multi-line comment:

-[This is
a multi-line
comment.]
print "Multi-line comment skipped."

Output:

Multi-line comment skipped.

Printscript Version 6 adds input.

It is fairly easy to use(Cat program beta. Limited to characters. Also only interpreted once.):

input a
print a

Input:

3

Output:

3

Version 7 supports logic operations.(and,or,and not)

The result goes to the former variable. (These only supports variables.)

Every logic operation is performed after subtracting each character by 48.

set a 0
set b 0
and a b
print a
set b 1
and a b
print a
set c 0
set d 0
or c d
print c
set d 1
or c d
print c
set e 0
not e
print e

Output:

00011

Version 8 now supports the if command. (Finally!) if syntax: followed by a variable. Checks if the ASCII value of the variable is greater than '0'. Terminated by 'end'. else syntax: followed by a variable. Checks if the ASCII value of the variable is equal to '0'. Terminated by 'end'. Here is a conditional example:

input a
if a
	print a
end
else a
	print "a is not 1!"
end

Input 1:

0

Output 1:

a is not 1!

Input 2:

1

Output 2:

1

Interpreter(in C)

Version 5 Version 6 Version 7 Version 8

See also

Note that after version 6(including version 6), Printscript is not output only anymore.