Changing the original 'parse string
[1/4] from: chaz:innocent at: 31-Dec-2000 23:23
Sounds like we've got all the pieces to make a Turing machine.
text: read http://www.ams.org/new-in-math/cover/turing.html
rule: [some [
a: "tape" b: (change/part a "block" b) |
a: "square" b: (change/part a "word" b) |
a: "head" b: (change/part a "parse cursor" b) |
a: "read/write head" b: (change/part a "parse cursor" b) |
a: "left-most bit of the first argument" b: (change/part a "beginning of
the first word" b) |
skip ]
]
parse text rule
save %turing.html text
chaz
At 07:12 AM 12/31/00 +1300, you wrote:
[2/4] from: al:bri:xtra at: 30-Dec-2000 8:30
I don't know if people know this, but this is how you can get 'parse to
change the parse string:
|[
Mark: "---" MarkEnd: (
MarkEnd: change/part Mark {—} MarkEnd
) :MarkEnd
]
In this example, I'm changing three dashes into the HTML named character
entity — and then skipping past the replacement, by using :MarkEnd.
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[3/4] from: brett::codeconscious::com at: 30-Dec-2000 15:14
I knew I could change the input string even at the current position so that
parse follows the modified input, but it never sunk in before your email
that I can set the current position of the input.
Ta.
With both bits of functionality one can do really really bizarre functions
in parse.
Brett.
[4/4] from: al:bri:xtra at: 31-Dec-2000 7:12
Brett wrote:
> With both bits of functionality one can do really really bizarre functions
in parse.
Like parse-ing the input string multiple times, or checking for the
existence of a pattern further along the string and returning to an earlier
point, and so on.
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/