minimal PostScript interpreter

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

And we really mean minimal. The idea is to restrict PostScript to as few operators as possible while still remaining interesting (unlike that disaster of a minimal Scheme interpreter problem not too long ago).

That is, the operators must allow for deterministic but variable output. Having no output is trivial, and outputting only identical values is boring. And nondeterministic output is just too crazy.

Since there are no existing operators that produce output while increasing the size of the operand stack, this cannot be accomplished with fewer than two operators. As it turns out, we can make do with just two operators: a creation operator (count) that adds values to the stack, and an annihilation operator (=) that consumes values and outputs them.

count -- this operator counts the number of objects currently on the operand stack and pushes this number onto the top of the stack (effectively increasing the stack size by one)

= -- this operator pops the top item off the stack and prints it to stdout, followed by a newline (effectively decreasing the stack size by one)

A legal PostScript program consists of a sequence of tokens separated by whitespace. For convenience, the whitespace in this problem will be a single space between adjacent tokens.

This is the challenge. What will your interpreter's character count =?

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

count = count =

Sample output:

0
0

Sample input:_

count = count count count count count count = count count count = count = count = = count count = count count = count count = = count count count count = = count = = = = = count = count = count count = count = count = count count = count count count count count count = count = = = = = = count = count = count = count count count = = = count = count count = count = = = = count = count count count = = = count = = = = = = =

Sample output:

0
5
7
7
7
6
7
8
9
8
11
10
10
9
8
7
6
6
6
7
7
7
8
13
13
12
11
10
9
8
8
8
8
10
9
8
8
9
9
8
7
6
6
8
7
6
6
5
4
3
2
1
0

Sample input:_

count = count count count count count count count count count count = count count = = = = = = = count count count count count count count count count count count = = = count count = = = count count count count = = count count = = count count count count count = count = count count count count = count = = = count count = = count = count = = count count = = count count = = count count count count count count = = count = count count = = = count = count count count = count = = = count = = count = = count count = count = = = count = count = = count count count count = count = count count = count = count = count = = count count count = = count = = = count count = count = = count count count = = = = = count = = = count = count count = count = = count = = = count = = = count = = = count count count count = count count = count count = count = count = = = = = count count count = count = = count count = count = = count = count count count count = count = = = = count count = = count count = count count count count = count = count count count count = = count count = count = = count count = count = = = = = count = = = = count count count = = count count count = = count = = count = = = = count = = count = = count count = = count = = count = = = = count = count count = count count count count count = count count = = count = = = = count count count = = = = = count count = count count count count count count = = = count count = count count = = count count = count = count = count = = count count count = count = count count = = count = count count = count count = count = = = = = = count count count = count count count = = count = = count = count count count = count count = = count = = = count count count count = = count = = count count count count count count count count = count = = = = = = count = = = count = count = count count = count = = = count count count count = count count count count = count count count = = = = = = count = count = = = count = count count = = count count = = = count = count = count count count count = = count = count = count = count count = count = count = = = count count count = count = count = = = = count count = count count = count count count count count = = count count count count count = = = count = = count = count count = = = = count count = count = = count = = = count = = = count count = = count = count count = = = count = = count count count count count = = = count = = = count = = = count count = count = = = count count count count count count = count count = count count count count = = count = count = = count = = count = count count = = = = count = = = count count count count count count count = count count = count count count count count = count count = count = count = = = = = count count count = count count count count = count = count count count = = count = = = count count count = = = count = count count = count = count = = = = = = = count = count = = = count = = count count count count = = count count = count count count = count = count = = count = count = = count = = = count = = count count = count = count count count count count = count = count count = count = count count count count count = = count = = = count count = = count count count count count = count = = = = count count count = count = = count count = = count count = = = = = = = count count count count count count = = count = = count = = count count = = = = = = = = count count = = count = count count count count = count = = count = count count count count = count count count count = = = = = = count count count count count = = count count = count = = count = count count count count count = = = count count count count = count = count = = count count = = = count count count = = count count = count = count count count = = = = = = = = count count = count = = count = count count = = count count count count count = count = count count = = count count = count count count = count = = count = = count count = = = = = = count = = count count = = = = = count = count count count count count = count count = count count count count count count = = = count count = count count = = = count count = = = = count = count = = count count count count = count count count count = = count count = = count count = = count = = = count = count = count = = count count = count count = = count = = = count count = = count count count = count count count count = = count count = count = = count count count count = = = count count = count = = count = = = = = count = = count = = count = count = = = count count = = count count count = count = count count count count = count count count count count = = = count = count count count count = count count = = = count = count count = = count count count = count = count count count = = count count count = count = count count = = = count count count = count count count count count = = = count = = = = count = count count = = = = = = = count = count count = count count = = = count count = count count = = = count = count = = = = count = = count count count count = = count count = count count count = = = count = = = = = count = count = count = count = count count = = count = = = count = = = = count count = count = = count = count = count count count = = count = count = = = count count = = count count = = count = count = count = = count = = count = count count = = = = count = count = count = count count count count = = count = = count = = count = = count = = = count = = = = count count = count count count = = = count count count count count = = = count = count count = = count = = count = = count count = = = count count count count = = = count count count count count count = = count count count = count count = count count = = = count = = count count = count count count = count = = count count = = = count count count = = = count count count count count = count = count count = count = count count count = count = = count count = = = count = = count = = count count count = count = = = count count = count count count = count count = = count = count = count = count = count = count count count count = = = = = count count = = count = count = count count count count count = = count = count count count count count count = count count count count = = count = = = count = count = = = = = count count = count = = count count count count count count count = count = count = count = count = count = count count = = = = = count = count count count = = count = = count count = count = = = count count count = count count = count = count count = count = count = count = = = count count = count = = count count count count = count = count = = = = = = = count count count count = count count = = = = = = count = = count count = = count = count = count count count count count count count = count count count = count = = count count count = = = = = = count count = count count = count count = = = = count count = count = = = count count = count count count count count count count = = = count = = count count count = count count count = = count = = count = = = = = = = = count = count count count count count count count = count count count count count count count count = = count = = count = count count count = = count = count count = count count count count = count count = = count = = = count = = count count count count count count = count count = = count = = count = = = = = = = count = = count = = count = count = count count count count = = = = count = = count count = count count count = count count = count count = = count count = = count = count = = = = = = = count = = = = count count = = count = = count count count = = count = count count count = = count count = count count = count = = count count count = = count = count = count = = count count = = count count count = count = = = = = count = count count count count = = = count = count = count = count count = = = count count = count = = count count = = = count count count count count = count = = count count = = = = = = count count count = count = = = count count = count count = count count = count count = = = count count count = = = = = = count = = count = count count count count count count = count count count = count count = count count = count = count = count count = = = = count = count = = = = = count count = count count count count = = count count = count = = = = = = = count = count count count = count = = count count = = = = = = = = = count = = count = = count count count = count = count = count = count = = = = count = count = count = count = count count = count count = count = count count = = count count = = count = = = = count count count count count count count = = = count count = = = count = = = = count = = = = count = = count count count = = count count = = = = = = count = count = = = count count = count = = =

Sample output:

0
9
10
9
8
7
6
5
4
14
13
12
13
12
11
14
13
14
13
17
17
20
20
19
18
19
18
18
18
17
18
17
18
17
22
21
21
22
21
20
20
22
22
21
20
20
19
19
18
19
19
18
17
17
17
16
19
19
20
20
20
20
19
21
20
20
19
18
19
19
18
20
19
18
17
16
16
15
14
14
15
15
14
14
13
12
12
11
10
10
9
8
11
12
13
13
13
12
11
10
9
11
11
10
11
11
10
10
13
13
12
11
10
11
10
11
14
14
17
16
17
17
16
17
17
16
15
14
13
13
12
11
10
12
11
13
12
12
11
11
10
9
8
8
7
7
6
7
6
6
5
5
4
3
2
2
3
7
8
7
7
6
5
4
6
5
4
3
2
3
8
7
6
7
8
7
8
8
8
8
7
9
9
10
9
9
10
11
11
10
9
8
7
6
8
10
9
9
8
8
10
11
10
10
9
8
11
10
10
9
16
16
15
14
13
12
11
11
10
9
9
9
10
10
9
8
11
14
16
15
14
13
12
11
11
11
10
9
9
10
9
10
9
8
8
8
11
10
10
10
10
11
11
11
10
9
11
11
11
10
9
8
9
10
14
13
17
16
15
15
14
14
15
14
13
12
13
13
12
12
11
10
10
9
8
9
8
8
9
8
7
7
6
10
9
8
8
7
6
6
5
4
5
5
4
3
8
9
12
11
11
11
10
10
9
9
10
9
8
7
7
6
5
11
12
16
17
17
17
16
15
14
13
15
18
18
20
19
19
18
17
19
18
17
17
18
18
18
17
16
15
14
13
12
12
12
11
10
10
9
12
11
12
14
14
14
13
13
13
12
12
11
10
10
9
10
10
14
14
15
15
19
18
18
17
16
17
16
20
20
19
18
17
19
19
18
19
18
19
18
17
16
15
14
13
18
17
17
16
16
15
16
15
14
13
12
11
10
9
10
9
9
12
12
11
11
14
17
16
15
14
13
12
16
15
16
16
15
15
19
18
17
20
20
20
19
20
19
18
20
19
20
20
22
21
20
19
18
17
16
15
16
16
15
15
16
15
19
19
20
19
20
22
22
21
21
20
21
20
19
18
17
16
16
15
16
15
14
13
12
12
16
17
22
21
20
21
22
21
20
21
20
19
18
18
18
17
20
23
22
23
22
23
22
22
21
20
20
20
20
19
20
21
20
20
19
18
19
18
20
23
22
23
23
22
25
24
23
24
24
23
23
22
21
20
19
19
18
18
17
17
17
16
15
16
15
17
17
20
24
23
22
22
25
26
25
24
24
25
24
26
26
28
27
29
29
30
29
28
30
34
33
32
32
31
30
29
29
30
29
28
27
26
25
24
24
25
26
25
24
25
26
25
24
24
24
23
22
21
21
20
23
22
23
25
24
23
23
22
21
20
19
19
19
19
19
20
19
19
18
17
17
16
15
14
15
15
14
14
14
16
15
15
15
14
13
14
13
14
13
13
13
13
12
12
11
11
12
11
10
9
9
9
9
12
11
11
10
10
9
9
8
8
7
6
6
5
4
3
4
6
5
4
8
7
6
6
7
6
6
5
5
4
5
4
3
6
5
4
9
8
10
11
12
11
10
10
9
10
12
12
11
12
11
10
12
11
10
14
14
15
15
17
17
16
17
16
15
15
14
14
13
15
15
14
13
14
16
17
16
16
16
16
16
16
19
18
17
16
15
16
15
15
15
19
18
18
23
26
25
25
24
23
23
23
22
21
20
19
20
20
19
25
25
25
25
25
25
26
25
24
23
22
22
24
23
23
22
23
23
22
21
23
24
24
25
25
25
25
24
23
24
24
23
26
26
26
25
24
23
22
21
20
23
24
23
22
21
20
19
19
18
19
18
18
18
24
26
26
25
27
26
25
24
23
22
23
24
25
24
23
22
23
23
22
21
22
28
27
26
26
25
27
29
28
28
27
27
26
25
24
23
22
21
20
20
26
33
32
32
31
31
33
32
32
33
36
37
36
36
35
34
34
33
38
39
38
38
37
37
36
35
34
33
32
31
31
30
30
29
29
29
32
31
30
29
29
28
29
31
32
33
32
33
32
32
32
31
30
29
28
27
26
26
25
24
23
24
23
23
22
24
23
23
25
24
25
26
26
25
27
26
26
26
26
25
26
25
27
27
26
25
24
23
23
26
25
24
24
24
24
25
24
23
24
24
23
24
23
22
26
26
25
26
25
24
23
22
21
23
23
22
21
22
23
24
25
24
23
25
24
23
22
21
20
20
19
19
24
26
27
28
28
28
29
28
27
26
26
26
25
24
23
22
23
26
25
26
26
25
24
23
22
21
20
20
22
22
21
22
21
20
19
18
17
16
15
14
14
13
13
12
14
14
14
14
14
13
12
11
11
11
11
11
12
13
13
14
13
14
13
13
12
11
10
16
15
14
15
14
13
13
12
11
10
10
9
8
7
7
6
8
7
8
7
6
5
4
3
3
3
2
1
2
2
1
0

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1leonid240.01092010/03/03 02:03:290B / 12B / 10B
2ksk260.00912010/02/28 21:05:210B / 11B / 13B
3murky-satyr260.01022010/03/03 02:23:250B / 12B / 13B
4yvl260.01022010/03/08 04:48:070B / 12B / 13B
5yibe280.00912010/03/03 00:14:410B / 16B / 10B
6primo330.00812010/03/02 19:52:260B / 16B / 15B
7shinh400.01222010/02/28 15:31:150B / 19B / 20B
8Luke Hewitt720.05342021/05/14 00:52:110B / ?B / ?B
9Fisher850.05192021/05/14 00:41:330B / ?B / ?B

Perl _

RankUserSizeTimeDateStatistics
1yibe250.00682010/02/28 18:45:320B / 12B / 11B
2ySas250.00672010/03/04 01:42:440B / 12B / 11B
3Mithran280.00282010/03/02 23:38:310B / 12B / 14B
4nai280.00312010/03/06 02:20:020B / 13B / 13B
5primo300.12792010/03/02 19:40:590B / 15B / 13B
6prakash320.12832010/03/10 06:09:270B / 12B / 19B
7shinh350.04552010/02/28 15:35:470B / 15B / 19B
8croyal720.00372010/03/04 06:33:230B / ?B / ?B

Python _

RankUserSizeTimeDateStatistics
1hallvabo560.01162010/03/02 14:26:110B / 30B / 17B
2gnibbler560.01352010/03/03 00:46:580B / 30B / 17B
3leonid560.01122010/03/03 04:00:350B / 30B / 17B
4gregh580.01442010/03/02 18:02:520B / 30B / 19B
5recursive580.00802010/03/03 05:16:440B / 34B / 18B
6tobiesque580.00762010/03/09 08:58:050B / 34B / 18B
7bords0610.03112010/03/13 06:12:573B / 30B / 19B
8betaveros630.01292010/03/06 11:55:133B / 30B / 20B
9shinh680.00992010/02/28 15:48:460B / 35B / 23B
10croyal690.00872010/03/04 05:51:060B / ?B / ?B
11Exelian770.00832010/03/08 06:20:505B / 34B / 21B

PHP _

RankUserSizeTimeDateStatistics
1o-cn490.06242010/03/02 20:31:592B / 22B / 25B

Scheme _

RankUserSizeTimeDateStatistics
1murky-satyr650.03312010/03/04 06:39:370B / 30B / 29B
2kaki670.24142010/03/03 05:15:470B / 39B / 23B
3kaki(0.9.1)580.19272011/06/13 00:19:410B / 28B / 25B
4kaki630.14742011/06/13 00:18:360B / 33B / 24B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima620.66392010/03/02 22:50:310B / 35B / 22B
2youz620.23262010/03/03 15:09:410B / 35B / 22B

Arc _

RankUserSizeTimeDateStatistics
1youz503.45082010/03/03 15:17:310B / 21B / 23B
2murky-satyr503.41322010/03/04 05:55:540B / 22B / 22B

Clojure _

RankUserSizeTimeDateStatistics
1murky-satyr523.04732010/03/04 05:16:060B / 25B / 24B
2youz543.21252010/03/05 12:02:320B / 21B / 29B
3croyal1093.21952010/03/04 23:42:180B / ?B / ?B

LilyPond _

RankUserSizeTimeDateStatistics
1KirarinSnow1052.28632010/03/04 12:00:480B / 58B / 44B

Io _

RankUserSizeTimeDateStatistics
1murky-satyr710.31382010/03/14 11:08:200B / 45B / 23B
2pooq730.32302010/03/07 04:45:470B / 50B / 20B

JavaScript _

RankUserSizeTimeDateStatistics
1murky-satyr510.06232010/03/04 11:01:570B / 22B / 28B
2nn510.06942010/03/09 14:19:180B / 27B / 24B
3xulapp520.07322010/03/11 12:42:180B / 28B / 24B
4ktt530.05302010/03/03 00:55:440B / 26B / 27B

Lua _

RankUserSizeTimeDateStatistics
1murky-satyr650.00832010/03/05 03:44:090B / 37B / 22B

Forth _

RankUserSizeTimeDateStatistics
151b690.17202010/03/06 21:16:300B / 45B / 8B
2zzo38480.07882011/05/10 15:14:000B / 30B / 7B
351b540.06262010/04/03 23:07:320B / 35B / 7B

BASIC _

RankUserSizeTimeDateStatistics
1*yuko*470.01132010/03/07 07:37:000B / 28B / 17B
2pooq510.00842010/03/07 08:56:360B / 30B / 14B
3*yuko*450.00982010/03/21 15:10:560B / 27B / 15B

Erlang _

RankUserSizeTimeDateStatistics
151b1281.72052010/03/06 20:19:000B / 58B / 65B
2Lost_dog1630.46802010/03/02 23:22:110B / 70B / 88B

J _

RankUserSizeTimeDateStatistics
1pooq270.30982010/03/05 23:41:560B / 6B / 21B

Jelly _

RankUserSizeTimeDateStatistics
1Erik the Outgolfer110.47092021/04/05 07:52:507B / 2B / 2B

C _

RankUserSizeTimeDateStatistics
1inaniwa600.00152010/02/28 19:34:350B / 28B / 32B
2chocobi600.00152010/03/06 19:05:470B / 28B / 32B
351b600.00152010/03/06 20:09:250B / 28B / 32B
4nn600.00152010/03/09 02:21:430B / 28B / 32B
5leonid630.00182010/03/03 05:01:060B / 34B / 29B
6nai630.00132010/03/05 23:42:200B / 32B / 31B
7gnibbler650.00972010/03/03 17:42:050B / 32B / 33B
8msk660.00152010/02/28 15:59:160B / 29B / 37B

C++ _

RankUserSizeTimeDateStatistics
1nn790.00162010/03/10 21:21:150B / 41B / 36B

D _

RankUserSizeTimeDateStatistics
151b800.00392010/03/06 20:10:160B / 48B / 29B

OCaml _

RankUserSizeTimeDateStatistics
1m.ukai1100.15842010/08/31 12:28:500B / 65B / 40B

Haskell _

RankUserSizeTimeDateStatistics
1rst76660.00512010/02/28 16:26:110B / 33B / 30B
2notogawa660.00502010/02/28 20:51:190B / 33B / 30B
3Lost_dog770.00372010/03/08 23:07:280B / 37B / 36B
4nobsun810.00512010/03/12 14:08:291B / 41B / 35B

Java _

RankUserSizeTimeDateStatistics
1hallvabo1160.33412010/03/05 13:26:510B / 76B / 37B
2mulder_fbi1280.33292010/03/07 07:32:090B / 81B / 44B
3nattow1410.43752010/03/07 00:02:210B / 95B / 41B

C# _

RankUserSizeTimeDateStatistics
1darefilz1230.16552010/03/10 04:04:340B / 77B / 41B
2chocobi1240.16162010/03/03 01:24:130B / 77B / 42B
3darefilz1200.15762010/03/16 04:01:440B / 77B / 38B

Maxima _

RankUserSizeTimeDateStatistics
1pooq720.37872010/03/06 12:00:340B / 42B / 25B

Asymptote _

RankUserSizeTimeDateStatistics
1chocobi621.58132010/03/04 00:45:240B / 38B / 21B
2teebee(chocobi)600.32992011/12/17 05:35:260B / 35B / 23B

AWK _

RankUserSizeTimeDateStatistics
1nn250.00182010/02/28 17:51:380B / 13B / 12B
2pgas260.00182010/03/06 07:06:000B / 13B / 13B

sed _

RankUserSizeTimeDateStatistics
1KirarinSnow1090.27782010/03/07 01:23:000B / 38B / 61B

Bash _

RankUserSizeTimeDateStatistics
1pgas530.09422010/03/06 04:41:120B / ?B / ?B
2zzo38100.28032010/04/06 02:50:430B / ?B / ?B
3yamaya290.04602010/09/10 00:45:230B / 17B / 11B

Zsh _

RankUserSizeTimeDateStatistics
1zzo38100.30582010/04/06 02:50:380B / ?B / ?B

Fish _

RankUserSizeTimeDateStatistics
1zzo38100.34312010/04/06 02:50:300B / ?B / ?B

m4 _

RankUserSizeTimeDateStatistics
1KirarinSnow1090.01812010/03/07 23:37:280B / 67B / 39B
251b11971.00902010/03/07 16:09:030B / 741B / 82B

Postscript _

RankUserSizeTimeDateStatistics
1KirarinSnow90.24862010/02/28 15:18:170B / 8B / 1B
2yshl90.25252010/02/28 18:30:340B / 8B / 1B

Befunge _

RankUserSizeTimeDateStatistics
1KirarinSnow440.10092010/03/04 11:45:520B / 9B / 31B

GolfScript _

RankUserSizeTimeDateStatistics
1KirarinSnow170.19002010/03/02 23:47:360B / 4B / 13B
2nn180.19352010/02/28 19:03:060B / 3B / 15B
3gnibbler190.20492010/03/02 22:39:050B / 4B / 15B
4betaveros220.31252010/03/06 12:02:320B / 6B / 16B
5gnibbler(symbol)280.21572010/03/03 02:09:530B / 0B / 26B

FlogScript _

RankUserSizeTimeDateStatistics
1zzo38180.92862010/03/28 09:30:020B / ?B / ?B

z80 _

RankUserSizeTimeDateStatistics
1GreaseMonkey590.00342010/03/11 15:12:4736B / 10B / 6B
2*yuko*380.03242010/09/07 17:27:1223B / 8B / 5B

Vim _

RankUserSizeTimeDateStatistics
1nn320.47152010/03/06 21:26:164B / 11B / 14B
2pla320.71752010/03/13 03:26:224B / 12B / 13B

goruby _

RankUserSizeTimeDateStatistics
1murky-satyr220.33982010/03/05 00:30:560B / 9B / 13B

Groovy _

RankUserSizeTimeDateStatistics
1nn483.73522010/03/14 11:19:410B / 30B / 18B
2murky-satyr483.73892010/03/14 11:52:070B / 30B / 18B

Scala _

RankUserSizeTimeDateStatistics
1murky-satyr6010.54452011/03/19 04:50:120B / 35B / 24B
2pooq6911.04892011/02/27 19:47:000B / 43B / 24B

Logo _

RankUserSizeTimeDateStatistics
1KirarinSnow490.43532011/03/19 08:19:220B / 25B / 19B
2KirarinSnow(actual no variables)530.44182011/03/19 08:09:160B / 29B / 21B
3KirarinSnow(no variables)660.28952011/03/19 07:53:120B / 36B / 18B

Language Ranking_

RankLangUserSizeScore
1PostscriptKirarinSnow910000
2Fishzzo38109000
3Zshzzo38109000
4Bashzzo38109000
5JellyErik the Outgolfer118181
6GolfScriptKirarinSnow175294
7FlogScriptzzo38185000
8gorubymurky-satyr224090
9Rubyleonid243750
10AWKnn253600
11Perlyibe253600
12Jpooq273333
13Vimnn322812
14z80*yuko*382368
15BefungeKirarinSnow442045
16BASIC*yuko*452000
17Groovynn481875
18Forthzzo38481875
19PHPo-cn491836
20LogoKirarinSnow491836
21Arcyouz501800
22JavaScriptmurky-satyr511764
23Clojuremurky-satyr521730
24Pythonhallvabo561607
25Schemekaki(0.9.1)581551
26Cinaniwa601500
27Scalamurky-satyr601500
28Asymptoteteebee(chocobi)601500
29Common LISPkozima621451
30Luamurky-satyr651384
31Haskellrst76661363
32Iomurky-satyr711267
33Maximapooq721250
34C++nn791139
35D51b801125
36LilyPondKirarinSnow105857
37sedKirarinSnow109825
38m4KirarinSnow109825
39OCamlm.ukai110818
40Javahallvabo116775
41C#darefilz120750
42Erlang51b128703

return to the top page