Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Using Qi as a scripting language: queries
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 28 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 3 July, 20:48
From: Mark Tarver <dr.mtar...@ukonline.co.uk>
Date: Fri, 3 Jul 2009 12:48:04 -0700 (PDT)
Local: Fri 3 July 2009 20:48
Subject: Using Qi as a scripting language: queries
I want to look at using Qi as a scripting language.

A.  Does anybody have experience using Lisp as a scripting language;
CLisp esp.
B  Has anybody got a copy of Red Hat Linux?  You should have a copy of
CLisp on it.

Just a thought; anybody used Qi to do scripts?

Mark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 3 July, 22:37
From: Henry Weller <hwell...@googlemail.com>
Date: Fri, 03 Jul 2009 22:37:22 +0100
Local: Fri 3 July 2009 22:37
Subject: Re: Using Qi as a scripting language: queries
Hi Mark,

> I want to look at using Qi as a scripting language.
> A.  Does anybody have experience using Lisp as a scripting language;
> CLisp esp.

I use Lisp as a scripting language both common Lisp using Clisp and Elisp
using emacs.

> B  Has anybody got a copy of Red Hat Linux?  You should have a copy of
> CLisp on it.

I use CLisp on SuSE and Ubuntu Linux but not on Red Hat.

> Just a thought; anybody used Qi to do scripts?

I have thought about it as a fun and useful way to learn how to program in Qi
but most scripts I write use regular expressions and/or escaped characters and
at the moment these can only be supported in Qi by hacking the core language.
My feeling is the issue of the comment character being the usual escape
character and Qi not providing an alternative escape character limits its
usefulness and this needs to be resolved particularly if Qi is to be used for
scripting.

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 4 July, 11:10
From: Mark Tarver <dr.mtar...@ukonline.co.uk>
Date: Sat, 4 Jul 2009 03:10:42 -0700 (PDT)
Local: Sat 4 July 2009 11:10
Subject: Re: Using Qi as a scripting language: queries

> My feeling is the issue of the comment character being the usual escape
> character and Qi not providing an alternative escape character limits its
> usefulness and this needs to be resolved particularly if Qi is to be used for
> scripting.

You can change this to what you want in 10 minutes.

Mark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 4 July, 12:25
From: Henry Weller <hwell...@googlemail.com>
Date: Sat, 04 Jul 2009 12:25:51 +0100
Local: Sat 4 July 2009 12:25
Subject: Re: Using Qi as a scripting language: queries
Mark,

>> My feeling is the issue of the comment character being the usual escape
>> character and Qi not providing an alternative escape character limits its
>> usefulness and this needs to be resolved particularly if Qi is to be used for
>> scripting.
> You can change this to what you want in 10 minutes.

Sure; Stefan posted the change to Qi to introduce \ as the escape character but
this clashes with the use of \ as the block-comment delimiter so I posted a
suggested change to Qi to introduce CL and Scheme style comments.  For all this
to hang together properly all the Qi source code needs to have comment style
changed so support for \ as the block-comment delimiter can be removed.  I am
prepared to do this once but at the moment I would need to redo everything for
every bug-fix, patch, addition and release of Qi unless you accept these changes
or equivalent in the definition of the language.

Do you have a plan to support an escape character in the definition of the
language at same point?  If so would you choose \ ?  If so what would you change
the comment delimiter to be?  And if not what would you choose as the escape
character?  What ever you decide I would be happy to attempt the implementation,
changes to the current Qi sources and testing the result.

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snorgers  
View profile   Translate to Translated (View Original)
 More options 4 July, 22:18
From: snorgers <stefan.ta...@spray.se>
Date: Sat, 4 Jul 2009 14:18:42 -0700 (PDT)
Local: Sat 4 July 2009 22:18
Subject: Re: Using Qi as a scripting language: queries
just to make things clear writing regular expressions means that you
probably need all
characters in the string and #\" is not possible to include in a
string in  a vanilla Qi session.
witout some really clunky work (see my html coloring code). It is
really good to be able to escape it into strings.
I vote for having this feature in future vanilla Qi.

/Stefan

On 4 July, 13:25, Henry Weller <hwell...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 4 July, 22:41
From: Mark Tarver <dr.mtar...@ukonline.co.uk>
Date: Sat, 4 Jul 2009 14:41:50 -0700 (PDT)
Local: Sat 4 July 2009 22:41
Subject: Re: Using Qi as a scripting language: queries
I have no problem with \.

There are so many options for programming in your own comment
delimiters into Qi using simple source hacking (about 10 lines of the
reader) or you can use strings like Norvig does in PAIP if you want.
Its a matter of personal taste and not a big issue at all.   I leave
it to people to do as they wish because the sources are there if they
want to change them. I certainly wouldn't spend time worrying over
this one.

On 4 July, 12:25, Henry Weller <hwell...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 4 July, 22:48
From: Mark Tarver <dr.mtar...@ukonline.co.uk>
Date: Sat, 4 Jul 2009 14:48:04 -0700 (PDT)
Local: Sat 4 July 2009 22:48
Subject: Re: Using Qi as a scripting language: queries
Probably the easiest solution is to have a programmable comment
delimiter set by default to \.  Then everybody can be happy.

(set-comment-start [#\! #\!])
(set-comment-end [#\Ł #\Ł])

makes

!! weird comment syntax here ŁŁ

a comment

Mark

On 4 July, 22:41, Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 4 July, 23:00
From: Mark Tarver <dr.mtar...@ukonline.co.uk>
Date: Sat, 4 Jul 2009 15:00:01 -0700 (PDT)
Local: Sat 4 July 2009 23:00
Subject: Re: Using Qi as a scripting language: queries
Its not that hard you know.

(make-string "here is a string in a string: ~S" "howdy")

gives

"here is a string in a string: \"howdy\"" : string

If you want to search the string using Qi you have to use 'explode' to
coerce it to a list of characters.

Mark

On 4 July, 22:18, snorgers <stefan.ta...@spray.se> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snorgers  
View profile   Translate to Translated (View Original)
 More options 4 July, 23:23
From: snorgers <stefan.ta...@spray.se>
Date: Sat, 4 Jul 2009 15:23:19 -0700 (PDT)
Local: Sat 4 July 2009 23:23
Subject: Re: Using Qi as a scripting language: queries

>> (make-string "here is a string in a string: ~S" "howdy")

Yep that eases my pain a little, but still writing regular expressions
means that you
need just one " sometimes. Maybe there is a trick to do this as well.

Stefan

On 5 July, 00:00, Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 4 July, 23:34
From: Henry Weller <hwell...@googlemail.com>
Date: Sat, 04 Jul 2009 23:34:43 +0100
Local: Sat 4 July 2009 23:34
Subject: Re: Using Qi as a scripting language: queries
Mark,

> Probably the easiest solution is to have a programmable comment
> delimiter set by default to \.

But if \ is the default comment delimiter what should be the default escape
character or do you think that character escaping is not needed is Qi as
indicated in your previous Emails?

I have no problem adding CL style comments to Qi and I have already done so and
posted the patch (I could even extend the approach to support a programmable
comment delimiter as you propose); my problem is if I make \ the escape
character it cannot also be the comment delimiter and all the Qi sources would
have to be edited to change the comment delimiters.  I can also do this as
mentioned in my previous Email but then it becomes a significant maintenance
problem and if I then post any Qi code I write people can only use it they use
my patched and edited version of Qi.

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snorgers  
View profile   Translate to Translated (View Original)
 More options 4 July, 23:42
From: snorgers <stefan.ta...@spray.se>
Date: Sat, 4 Jul 2009 15:42:24 -0700 (PDT)
Local: Sat 4 July 2009 23:42
Subject: Re: Using Qi as a scripting language: queries
Hmm,

When reading in a file with load we have the problem that that whole
file goes through
the reader before it is interpreted. Now we might want to be able to
inject some code
in the beginning of a file to describe the usage of some syntactic
constructs. You could
solve this by using multiple files but it is a mess and a pain or?

But anyway one idea to solve this issue would be to set the syntactic
preferences in the
beginning of the file.

/Stefan

On 5 July, 00:34, Henry Weller <hwell...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 5 July, 08:22
From: "Mark Tarver" <dr.mtar...@ukonline.co.uk>
Date: Sun, 5 Jul 2009 08:22:30 +0100
Local: Sun 5 July 2009 08:22
Subject: Re: Using Qi as a scripting language: queries
If you want to search *inside* a string then you can explode it to a list of
characters.

A bit more subtle and generally less cumbersome is to map it to a list of
tokens.

(define tokenise
   {string --> [string]}
   String -> (let Chars (reverse (tail (reverse (tail (explode String)))))
                        Tokens (read-chars-as-stringlist Chars (/. X (= X
#\Space)))
                        Tokens))

(tokenise "Hello World")
["Hello" "World"] : (list string)

If you want to parse a file then use read-file-as-charlist (very fast) and
tokenise to a list of strings using your tokeniser.  Then proceed as normal.
This is the way to process HTML.

Mark

----- Original Message -----
From: "snorgers" <stefan.ta...@spray.se>
To: "Qilang" <Qilang@googlegroups.com>
Sent: Saturday, July 04, 2009 11:23 PM
Subject: Re: Using Qi as a scripting language: queries

>> (make-string "here is a string in a string: ~S" "howdy")

Yep that eases my pain a little, but still writing regular expressions
means that you
need just one " sometimes. Maybe there is a trick to do this as well.

Stefan

On 5 July, 00:00, Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 5 July, 09:56
From: Henry Weller <HWell...@googlemail.com>
Date: Sun, 05 Jul 2009 09:56:46 +0100
Local: Sun 5 July 2009 09:56
Subject: Re: Using Qi as a scripting language: queries
Mark,

My plan is to write Qi wrappers for the cl-ppcre library and then I can use all
the perl-style regular expressions I already have which currently include \s.  I
can't see an easy way to do this without adding support for \ in Qi strings
(i.e. reinstate string functionality present in the underlying CL language), or
at least another escape character which \ can easily be translated to \ when
transferring regular-expressions from elsewhere.  Can you suggest how this might
be done without introducing an escape character into Qi?

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snorgers  
View profile   Translate to Translated (View Original)
 More options 5 July, 11:40
From: snorgers <stefan.ta...@spray.se>
Date: Sun, 5 Jul 2009 03:40:32 -0700 (PDT)
Local: Sun 5 July 2009 11:40
Subject: Re: Using Qi as a scripting language: queries
Hi Henry,

backslash in strings is translated verbatim like

  (define f "\a" -> "\b")

which compiles just fine

So actually vanilla Qi will make your life easier here if I understand
it correctly
and you do not need to escape the backslash all the time.

So there might be another reason for the problems you see (syntax
coloring?)

/Stefan

On 5 July, 10:56, Henry Weller <HWell...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 5 July, 12:29
From: "Mark Tarver" <dr.mtar...@ukonline.co.uk>
Date: Sun, 5 Jul 2009 12:29:18 +0100
Local: Sun 5 July 2009 12:29
Subject: Re: Using Qi as a scripting language: queries
I'm kind of stuck seeing what it is you are having difficulty with.  Can you
post a concrete example?

Mark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snorgers  
View profile   Translate to Translated (View Original)
 More options 5 July, 13:58
From: snorgers <stefan.ta...@spray.se>
Date: Sun, 5 Jul 2009 05:58:45 -0700 (PDT)
Local: Sun 5 July 2009 13:58
Subject: Re: Using Qi as a scripting language: queries
maybe something like this regular expression

"[^\"]*"   = [^"]*

which can be used to do an alternative Qi vanilla string parsing. It
containes one "
and I can only make that regex by building it from characters.

Anyway we have another options used in VB.

""  translates to "

(defcc <string>
  #\" #\"                       <string> := [#\" | <string>];
 (not-double-quote? -*-) <string> := [-*- | <string>];
 <e>                                        := [];)

/Stefan

On 5 July, 13:29, "Mark Tarver" <dr.mtar...@ukonline.co.uk> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snorgers  
View profile   Translate to Translated (View Original)
 More options 5 July, 16:46
From: snorgers <stefan.ta...@spray.se>
Date: Sun, 5 Jul 2009 08:46:28 -0700 (PDT)
Local: Sun 5 July 2009 16:46
Subject: Re: Using Qi as a scripting language: queries
Mark,

I have not used Qi or lisp as a scripting environment, I like the idea
of using it though
and love to help making a smooth qi environment for scripting. Clisp
should not be a problem.

Cheers
Stefan

On 5 July, 14:58, snorgers <stefan.ta...@spray.se> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 5 July, 19:49
From: Henry Weller <HWell...@googlemail.com>
Date: Sun, 05 Jul 2009 19:49:44 +0100
Local: Sun 5 July 2009 19:49
Subject: Re: Using Qi as a scripting language: queries
Mark,

> I'm kind of stuck seeing what it is you are having difficulty with.  Can you
> post a concrete example?

My initial problem came form embedding strings in documentation strings:

"This is some documentation for the string \"a string\" and more stuff"

Stefan posted a patch to add support for the \ escape character which solved
this problem but introduces a parsing problem due to the ambiguous use of \ as
the escape character and the comment delimiter, for example how could you have
escaped characters in comment strings?.  Another problem this ambiguity
introduces is adding support for font-locking and other nice features to editors
such as Emacs which already have built-in rules for escape characters and
comment delimiters but which do not allow both to be the same.  This issue can
in part be resolved using context analysis but this is rather complicated to
editors and makes Qi a less attractive language to work with.  There is more
detail about my fight with Qi over escaping characters in previous threads which
I can dig up if you would like to review the problems and possible solutions.

My feeling is that either an alternative escape character to \ should be chosen
or the comment delimiter cannot remain \ or character escaping is not supported
as is currently the case.  I cannot achieve my aims without adding support for
an escape character and would rather \ was chosen so my vote is for changing the
comment delimiter but I really do not mind to what it is changed.  I only
suggested the CL-style (with a test implementation) because it is consistent
with the underlying language but the Haskell, C++, Java etc. styles are all fine
as well as is anything else which does not clash with other character sequences
used the definition of the language.

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
snorgers  
View profile   Translate to Translated (View Original)
 More options 5 July, 21:18
From: snorgers <stefan.ta...@spray.se>
Date: Sun, 5 Jul 2009 13:18:56 -0700 (PDT)
Local: Sun 5 July 2009 21:18
Subject: Re: Using Qi as a scripting language: queries
Yes this is not so smooth.

Consider

(define f
   #\a -> ...)

And you want to comment it out or you want to discuss it in a comment.
and you get into these issues, not so smooth. I can live with this but
it is not
a selling point for Qi.

/Stefan

On 5 July, 20:49, Henry Weller <HWell...@googlemail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 5 July, 21:27
From: "Mark Tarver" <dr.mtar...@ukonline.co.uk>
Date: Sun, 5 Jul 2009 21:27:02 +0100
Local: Sun 5 July 2009 21:27
Subject: Re: Using Qi as a scripting language: queries

> My initial problem came form embedding strings in documentation strings:

> "This is some documentation for the string \"a string\" and more stuff"

> Stefan posted a patch to add support for the \ escape character which
> solved
> this problem but introduces a parsing problem due to the ambiguous use of
> \ as
> the escape character and the comment delimiter, for example how could you
> have
> escaped characters in comment strings?.

As I pointed out this is not a problem.  You *can* construct these strings
in Qi, you just
cannot read them back in to the Qi top level.  But not everything you can
construct can be read
back in - the evaluated form of (/. X X) etc - which holds for CL too btw.
Likewise there is
a class of unreadable strings in Qi which cannot be read in verbatim but
they can always be
constructed.  Including the dreaded ^ which is is the nuke key.  And there
are unprintable
characters in CL too.

> Another problem this ambiguity
> introduces is adding support for font-locking and other nice features to
> editors
> such as Emacs which already have built-in rules for escape characters and
> comment delimiters but which do not allow both to be the same.

OK; so it suits Emacs less because this possibility was not envisaged by the
designers.
On the other hand following your approach would mean rewriting every
commented Qi
program ever written just to make font locking in Emacs easy.   And some
people would
not like that either.  (Me actually, I don't use Emacs).

 I think what you need is a programmable delimiter which you can set
(think of SET-SYNTAX-FROM-CHAR).  It will allow your Qi programs to be
portable
and you can choose whatever delimiter style you like.

Mark

This issue can


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 5 July, 22:05
From: Mark Tarver <dr.mtar...@ukonline.co.uk>
Date: Sun, 5 Jul 2009 14:05:29 -0700 (PDT)
Local: Sun 5 July 2009 22:05
Subject: Re: Using Qi as a scripting language: queries
OK; then we will have programmable delimiters and a programmable
escape character and maybe a programmable abort ^ character too.
The question is how the defaults are set and for now it seems best to
set them to FPQi.  Likely future candidates are C++ delimiters and \
for the escape.

I would suggest that you fix the delimiters to C++ syntax in your
programs if you wish and in the next release I'll include a
programmable feature for setting your delimiters etc.  You will need
2-3 lines of boilerplate in all your Qi files.

We can have a plebiscite on the defaults at a later date.

Mark

On 5 July, 21:18, snorgers <stefan.ta...@spray.se> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 5 July, 23:55
From: Henry Weller <HWell...@googlemail.com>
Date: Sun, 05 Jul 2009 23:55:24 +0100
Local: Sun 5 July 2009 23:55
Subject: Re: Using Qi as a scripting language: queries
Mark,

> OK; then we will have programmable delimiters and a programmable
> escape character and maybe a programmable abort ^ character too.
> The question is how the defaults are set and for now it seems best to
> set them to FPQi.  Likely future candidates are C++ delimiters and \
> for the escape.

I have coded CL and Scheme style comments but can easily change this code to
support C++ style comments if you prefer and post it if you or others would like
it.  Given that the underlying language is CL why would you prefer to see the
C++ style used?  I don't mind either way as they offer equivalent functionality.
I do however like the #; expression comment in Scheme which I have coded for Qi
but which does not have an equivalent in C++.

> I would suggest that you fix the delimiters to C++ syntax in your
> programs if you wish and in the next release I'll include a
> programmable feature for setting your delimiters etc.  You will need
> 2-3 lines of boilerplate in all your Qi files.

That's great!

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
(1 user)  More options 6 July, 00:16
From: Henry Weller <HWell...@googlemail.com>
Date: Mon, 06 Jul 2009 00:16:50 +0100
Local: Mon 6 July 2009 00:16
Subject: Re: Using Qi as a scripting language: queries

> As I pointed out this is not a problem.  You *can* construct these strings in
> Qi, you just cannot read them back in to the Qi top level.

Yep, and this is a problem.

> But not everything you can construct can be read back in - the evaluated form
> of (/. X X) etc - which holds for CL too btw.

Sure

> Likewise there is a class of unreadable strings in Qi which cannot be read in
> verbatim but they can always be constructed.  Including the dreaded ^ which is
> is the nuke key.  And there are unprintable characters in CL too.

Sure, but I think it is important to be able to handle the escape character in a
simple way as it is so commonly used.

>> Another problem this ambiguity
>> introduces is adding support for font-locking and other nice features to
>> editors
>> such as Emacs which already have built-in rules for escape characters and
>> comment delimiters but which do not allow both to be the same.
> OK; so it suits Emacs less because this possibility was not envisaged by the
> designers.

Not just Emacs but all editors that I know of that have this kind of
functionality.  They generally use simple, efficient passing methods for
font-locking etc. which do not handle ambiguities very well.  Of course a
complete Qi parser could be written in Elisp, or the scripting language for vim,
or eclipse etc.  but this would be a significant effort and one which is not
needed for other languages.

> On the other hand following your approach would mean rewriting
> every commented Qi program ever written just to make font locking in Emacs
> easy.

The problem is not limited to Emacs; having \ as the escape character and the
comment delimiter is a problem for all simple parsing strategies for Qi which
are used in editors and possible other code analysing tools.  My feeling is that
Qi would benefit from this ambiguity being removed and a two-character comment
delimiter introduced preferably with the option for having single line comments
and even better the option for expression comments.

>  I think what you need is a programmable delimiter which you can set
> (think of SET-SYNTAX-FROM-CHAR).  It will allow your Qi programs to be
> portable
> and you can choose whatever delimiter style you like.

OK.  For now I will change my patch to use C++ style comments as you suggest.
Shall I drop support for commenting expressions or are you interested in
supporting this in a future Qi release.  If you are interested in this
functionality what delimiter would you use for it?  At the moment I have

;;
#| |#
#;

which will become

//
/* */
and what?

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 7 July, 08:27
From: Henry Weller <HWell...@googlemail.com>
Date: Tue, 07 Jul 2009 08:27:28 +0100
Local: Tues 7 July 2009 08:27
Subject: Re: Using Qi as a scripting language: queries
Mark,

> As I pointed out this is not a problem.  You *can* construct these strings in
> Qi, you just cannot read them back in to the Qi top level.  But not everything
> you can construct can be read back in - the evaluated form of (/. X X) etc -
> which holds for CL too btw.  Likewise there is a class of unreadable strings
> in Qi which cannot be read in verbatim but they can always be constructed.
> Including the dreaded ^ which is is the nuke key.

I have just been playing with regular expression strings and it is indeed
difficult to handle ^, e.g. in "[^abc]" which Qi cannot read in; can ^ be
escaped as \^ in Qi-1.07?.  What is the easiest way to read regular
expressions in Qi?  Do we need to write some regular expression creation
functions to get around the problem of Qi using some of the regular expression
characters for other purposes?

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Henry Weller  
View profile   Translate to Translated (View Original)
 More options 7 July, 12:37
From: Henry Weller <HWell...@googlemail.com>
Date: Tue, 07 Jul 2009 12:37:03 +0100
Local: Tues 7 July 2009 12:37
Subject: Re: Using Qi as a scripting language: queries
Following the proposed C++ convention rather than the CL convention how about

/* Nested block comment */
// Single line comment
/; (func "Single statement comment which can handle sexps and other Qi statements.")

Does the /; clash with other possible uses of /; in Qi?

Henry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 28   Newer >
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google