r/programming • • Jun 11 '11

Whitespace Grammar

http://imgur.com/Oi1ZO
0 Upvotes

31 comments sorted by

7

u/[deleted] Jun 11 '11

5

u/[deleted] Jun 11 '11

for those who think this is simply a joke, here is the white space code excerpt made visible:

[space][space][space][space][space][space][tab][tab][space][tab][new_line][space][space][space][space][tab][new_line][space][space][space][space][space][space][tab][new_line][space][space][space][space][space][space][new_line][space][space][space][space][tab][new_line][new_line][new_line]

Of course it is a joke, but not a simple one.

1

u/[deleted] Jun 11 '11

[removed] — view removed comment

4

u/Nickolas1985 Jun 11 '11 edited Jun 11 '11

Not really. Whitespace differs quite a lot, being more convenient - well, as soon as you make tabs and spaces visible in your editor. Not to mention that it's stack-based, and Brainfuck is not. Took me ages to write examples for this article

1

u/[deleted] Jun 11 '11

Chris Morris <=> Chuck Norris

2

u/BesideThePoint Jun 11 '11

Dare I say, 0?

64

u/anyfoo Jun 11 '11

Nice try, but I don't think that's right. Whitespace itself consists entirely of whitespaces, yes, but grammar representations are usually syntax diagrams, (E)BNF or other such similar things. You wouldn't see the terminal symbols, but everything else like shapes and lines in diagrams or non-terminal symbols in BNF.

Maybe you created a grammar describing metalanguage that itself also consists of nothing but whitespace, but nobody would know it.

Yeah, I'm fun at parties, why do you ask?

15

u/gospelwut Jun 11 '11

I like people like you.

19

u/zwangaman Jun 11 '11

You might want to consider not going to any more parties.

5

u/[deleted] Jun 11 '11

Obviously it's a full graph but the lines and shapes and text are all white.

Apparently this is the latest design fad or something.

3

u/TNorthover Jun 11 '11

As it's forged such a striking new path through syntax, we should surely allow it similar leeway in revolutionising metasyntax.

1

u/kristopolous Jun 12 '11

Yes. I clicked immediately thinking "oh goodie ... a nice complex document" and then I saw a white image and was thinking "oh, it's a joke . so . sad . why?"

I moved over to the comments, hoping to be redeemed by someone doing something with

\s \t \n

or whatever the set is, but NO! nothing here. Maybe the source code has yacc or bison in it ... let me look. this is ok

1

u/iAmRistretto Jun 12 '11

OP gets 4 upvotes, you have 65. I love reddit.

4

u/AMillionMonkeys Jun 11 '11

See, why did I click on that, knowing what the language is?

6

u/neerg Jun 11 '11

Take a funny comment from c/c++ grammar posts, make it into your own link, brilliant.

3

u/foldM Jun 11 '11 edited Jun 11 '11

I'm waiting for the Piet grammar.

2

u/[deleted] Jun 11 '11

My favourite example of why the tab character isn't entirely an abomination.

0

u/yellowstuff Jun 11 '11

Because without it you couldn't implement the Whitespace language?

2

u/jevon Jun 11 '11

Ah yes, the whitespace hello world:

                              
              
                                                       
                                                     
                                    
                                                     
              
                          

7

u/schplat Jun 11 '11

You need to put that in a code block IMO.

5

u/phort99 Jun 11 '11

It is!

(Highlight it, it's indented)

2

u/ElkFlipper Jun 11 '11

I need to clean my monitor.

2

u/spotter Jun 11 '11

At least it's not a JPG.

2

u/mrjast Jun 11 '11

I think the " " operator is missing.

1

u/quzox Jun 11 '11

Can we also have one for Brainfuck and Malbolge please.

7

u/Portponky Jun 11 '11

BF's grammar is just eight commands and the only restriction is the brackets must match up. BF isn't really a complicated langauge at all, just restrictive.

1

u/IDownvoteOverposters Jun 11 '11

There doesn't seem to be