Hi Dave,

> I am having some trouble working with Strings or Transient Symbols.
> (I'll call them strings for now.)
> ... 
>       "^(a+)\)"
> In picoLisp, I must enter that as:
>       "\^(a+)\\)"

That's right. This is the syntax of the PicoLisp reader.


> See, the escaping syntax is a pretty heavy burden for the types of strings I 
> work with...
> 
> So, I considered using a reader macro.  I imagined something like:
> 
>       (re-handler /^(a+)(.*)'.*(\)+)/ "aaaand here's some input! :))))")
> -->
>       (re-handler "\^(a+)(.*)'.*(\\)+)" "aaaand here's some input! :))))")

A read macro won't help, because it is still based on 'read', the
PicoLisp reader synax. A read macro reads an expression, evaluates it,
and returns the result to the reader.


> ..Then I discovered that we don't have a defmacro. (I've read previous
> discussion about macros and I accept Alex's stance.)

A macro won't help either, because it also processes the data *after*
they are read by the Lisp reader. And though you can do everything a
macro would do in PicoLisp with a normal function, it also operates on
s-expressions and not on the input stream.


> Any advice for implementing some sort of special case for /strings/,
> which would be just like "strings" but with different escape mechanics?

On the *application* level, you can do everything you like, using
low-level I/O functions like 'char' and 'line'.

I think the problem is that you want to change the *language* level, and
the reader is the core of the language (read/eval/print).


> I see src64/io.l contains (code 'readA_E) which handles reading
> "strings". But I don't understand this assembly code.

Yes, that's the right place to change the language :)


The normal REPL (i.e. the 'load' function) doesn't operate on raw input
data.

What you could do is write you own top-level REPL, using e.g. 'line' and
'eval' directly. Another possibility is using 'pipe' and perhaps
external tools to process the input stream. In any case you need to get
hold of the data and process them *before* they are seen by the reader.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to