[Top][All Lists]

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

Re: Is intellisense features integration in Emacs technically possible?

From: David Engster
Subject: Re: Is intellisense features integration in Emacs technically possible?
Date: Wed, 22 Jan 2014 19:34:36 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

Óscar Fuentes writes:
> David Engster <address@hidden> writes:
>>> Writing a C++ parser and semantic analyzer from scratch requires several
>>> man-years of work for world-class compiler writers.
>> You don't need a full parser. For providing completions, it is
>> sufficient to parse only a small subset of the code (declarations, most
>> importantly).
> Even for providing completions you need semantic analysis.

Of course you need that. Where did I say otherwise? I'm saying that when
you get parsing of declarations right, and have some good heuristics to
parse the local context, then this will suffice for most cases.

Parsing code like this also has some advantages, mostly that it is more
fault-tolerant. This is actually very important, since while you're
coding, your code will often be syntactically wrong.

> The parser turns to be insufficient on very simple cases:
> auto foo = bar();
> foo. ????

Well, type inference is hard. Currently, C++11 isn't on my agenda. But
I'm confident simple cases like the above will be manageable.

> The need for semantic analysis is unavoidable even on the "old" C++ 98:
> template <typename T> struct Foo {
>   typedef T Type;
> };
> struct Bar {
>   int something() {
>     return 42;
>   }
> };
> void some_func() {
>   typename Foo<Bar>::Type t;
>   t. ???
> }

This will work after I've applied my template patch.


reply via email to

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