Identifiers

0 views
Skip to first unread message

Bryan....@gmail.com

unread,
Apr 17, 2007, 1:27:42 PM4/17/07
to Cat Language
Hello,

I've been playing around with Cat a little bit recently, and I have a
few comments, but I'll just start out with just this one question.

In your grammar, you have the following rules:

identifer ::==
alphanum+ |
group_symbol* |
single_symbol |

group_symbol ::==
[~,#,$,%,^,&,*,-,+,=,|,\,:,;,<,>,.,?,/]

alphanum ::==
letter |
number

I'm wondering if there is any reason that 'alphanum' and
'group_symbol' are kept separate in the identifier. I would think
since, by the nature of stack languages, there are no infix symbols,
there would be no need to keep these separate. Take, for example
Scheme, which also has no infixes; in Scheme you can name things "my
+function" or "|->i*i<-|", or a non-contrived example, "call-with-
current-continuation". Is there any reason for not allowing this is
Cat?

As an example, say somebody would someday want to write an html
library, they could do something like:

define <p> { "<p>" }
define </p> { cat_str "</p>" cat_str }

So the following code:

<p> "This is in my paragraph" </p>

Yields:

"<p>This is in my paragraph</p>"

I think it gives just a little bit more freedom in name identifiers.
Just curious,

Bryan Burgers

Christopher Diggins

unread,
Apr 17, 2007, 6:34:36 PM4/17/07
to catla...@googlegroups.com
As far as I can tell Bryan, that is an excellent idea! I was used to
the C syntax of not requiring whitespace, i+=1 which to be honest, I
never used, and abhor looking at. Besides as you point out, it isn't
really neccessary in a stack-based language.

I will spend a couple of days mulling it over, but will probably add
the feature in the release after next.

Thanks for the suggestion!
Christopher Diggins

Reply all
Reply to author
Forward
0 new messages