emacs-devel
[Top][All Lists]
Advanced

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

Re: Dynamic loading progress


From: Stephen Leake
Subject: Re: Dynamic loading progress
Date: Sat, 14 Feb 2015 18:35:25 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt)

Eli Zaretskii <address@hidden> writes:

>> From: Stephen Leake <address@hidden>
>> Date: Sat, 14 Feb 2015 09:32:54 -0600
>> 
>> Emacs ada-mode does indentation in two steps; first it parses the source
>> code, and the parser actions are lisp functions that eventually call
>> put-text-property to store information about the syntax and/or semantics
>> on many identifiers. Then the indentation code uses those text
>> properties to compute indentation.
>> 
>> I have a generalized LALR parser implemented in elisp that is fast
>> enough for many user's Ada files, but some users have much bigger files,
>> and it takes them 10 seconds to parse. So I need a faster
>> implementation. So far my benchmarking says I can get close with a
>> machine compiled parser.
>> 
>> So the module would contain the generalized LALR parser; the actions of
>> the parser would still be calls to the lisp functions.
>
> But this means your mode is in Lisp to begin with, and it just calls
> functions implemented in C to work faster.  So you could leave the
> calls to put-text-property in Lisp, and have the functions implemented
> in the module return the information required to compute the arguments
> to put-text-property.  Or am I missing something?

The parser actions are callbacks; when the parser recognizes a complete
grammar sentence (ie a statement, function declaration, etc), it calls
an action (which in this case is a lisp function), then resumes parsing.
Each file contains many grammar sentences, so there are many calls to
lisp functions from within the C parser. (Actually, the parser is in
Ada, but that's a separate issue).

I could redefine the parser actions to store the required info in a
list, and at the end of parsing return that list, and then process the
list in elisp. But I've already tried that with the parser in an
external process; just processing the returned list is too slow. I need
direct calls.

-- 
-- Stephe



reply via email to

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