help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How the backquote and the comma really work?


From: Pascal J. Bourguignon
Subject: Re: How the backquote and the comma really work?
Date: Sun, 23 Aug 2015 18:46:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> On 2015-08-12, at 18:30, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
>
>> Michael Heerdegen <michael_heerdegen@web.de> writes:
>>
>>> Marcin Borkowski <mbork@mbork.pl> writes:
>>>
>>>> Interestingly, there's a lot of buzz about Lisp /interpreter/ written
>>>> in Lisp, but not so much about Lisp /reader/ written in Lisp.  In
>>>> fact, I didn't find one on the Internet.
>>
>> Not looking good enough.
>>
>> https://gitlab.com/com-informatimago/com-informatimago/tree/master/common-lisp/lisp-reader
>
> Thanks!
>
>> and of course, there's one in each lisp implementation.
>
> But often in C or something, not in Lisp.

Nope.  Only clisp and ecl have a lisp reader written in C.  All the
other implementations have it in lisp (or perhaps java).


> And most probably I'll end up coding an abstraction like this, with
> a function for looking at the next token without “consuming” it, and
> a function for “popping” the next token.  Converting between buffers and
> streams wouldn’t be very useful for me, since I would either lose the
> whole text structure (line-breaks, comments), or have to do a lot of
> work to actually preserve it.

Not necessarily.  Just add the required information to your token
structure, and you can also intersperse pseudo tokens for line-breaks
and comments, (but this renders the grammar more hairy, since you have
to allow for them between any other token; instead, you can just filter
them out before the actual parsing).


> OTOH, here I walk an Emacs buffer and not an external file.  Moreover,
> as I said, I don’t want to lose info on where I am in the source.

In this case, you already have the whole source in memory…

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

[Prev in Thread] Current Thread [Next in Thread]