root/hodgestar/WhitespaceCode/tabs2spaces/comment.embedded @ 425

Revision 425, 1.1 kB (checked in by hodgestar, 23 months ago)

Playing around with Whitespace.

RevLine 
[425]1===
2Embedded Programming ==
3I have written a tabs
4to      spaces
5converter       in Whitespace [1] and embedded [2]
6it      into    this    comment. You'll
7need the Python interpreter     from    [3]
8because the Haskell one doesn't
9report  EOFs nicely.     Usage:
10python main.py
11file-containing-this-comment < file-with-tabs > file-with-spaces         I have included
12the     dissambled [4] code     below
13for     your convenience.       Hopefully       the
14blog
15software doesn't
16discard the (extremely
17meaningful)
18whitespace in this      comment!
19[1]     http://compsoc.dur.ac.uk/whitespace/
20[2] http://compsoc.dur.ac.uk/whitespace/tools.php [3]
21http://www.mrphlip.com/pywhitespace.tar.bz2 [4]
22http://yagni.com/whitespace/index.html   === Source
23Code
24===  label      1       
25# read
26a
27char and put copies     on the stack push 0 readchar
28push 0
29retrieve  #
30compate to EOF
31and jump        to
32end if it       matches
33dup push -1     sub
34jz 5    #
35compare to \t
36and jump
37to      3 if it
38matches
39 dup push       9 sub jz
403
41jump 2
42        #
43non-tab
44label 2 outchar jump 4 
45#
46tab
47label
483
49discard
50push 32
51dup
52dup
53dup
54outchar
55outchar
56outchar
57outchar
58jump 4
59
60# goto start
61label 4
62jump 1
63
64# end
65label 5
66exit
Note: See TracBrowser for help on using the browser.