Some of what we've been talking about on the Web_Dialect list.
Subscribe: [EMAIL PROTECTED]
--------------------------------------------------------------
I've been thinking some more about dialects this afternoon - so I
thought it best to keep on this topic... ^_^ :-)

I've been wondering how it is that the parse dialect works, yet there
is no obvious dialect word or such like. I also thought about objects.
Much like, say, this one:

                HTML: make object! [
                        Head: ...
                        Body: ...
                        ]

        and I thought to myself, 'Head and 'Body are in the _context_ of the
'HTML object. Parse rules make no sense outside their block. Neither do
words, that are in a object, make sense out of it. So then I came
inside and played with REBOL, and invented a HTML dialect on the spot
(I'm typing it into the REBOL console):

>> MyHtmlDialect: [
[    Head
[    Title "My Example Title!"
[    Body [Text Black BGColor Cream]
[    H1 Title
[    {This document discusses dialects!
{        It should be easy to read as it's written
{        with a new HTML dialect designed and developed on OpenWeb.}
[    P {This is a new paragraph.}
[    UL
[    LI "Point 1"
[    LI "Point 2"
[    LI "Point 3"
[    ]
== [
    Head
    Title "My Example Title!"
    Body [Text Black BGColor Cream]
    H1 Title
    {This document discusses diale...

Seems fairly easy and there's very few blocks required. So what
processes it? This (or something very close to it):

HTML!: make object! [
        Head: func [] [print "I'm a Head!"]
        Body: func [] [print "I'm a Body!"]
        Dialect: func [Language [block!]] [
                if error? try bind Language 'Body [
                        print "Problems!"
                        exit
                        ]
                print "OK!"
                ]
        ]

And here it is running (with a very small example):

>> HTML!/Dialect [head body]
I'm a Head!
I'm a Body!
OK!

Comments?

Andrew Martin
On a journey of discovery to mist shrouded continents...
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
-><-

Reply via email to