Automatic code refactoring

Sylvain Joyeux sylvain.joyeux at m4x.org
Wed Mar 2 09:12:06 UTC 2005


> The benefit is that all these languages already have BNF/EBNF files
> readily available and so a centralized parser will reduce develop time
> of new language support, as well as reduce the likely-hood of
> incorrectly parsing these new languages.
Correct me if I'm wrong, but my courses in compilation are quite old ...

BNF/EBNF grammars are a way to write grammars. In fact, they are made of 
production rules, which is a formalism used to express the grammars of 
most of the parsing algorithms but ...
The main problem is the parsing algorithm ... most of the tractable 
algorithms can't use these grammars directly because they are too 
ambiguous [1]

> In many cases, the BNFs could also be used to derive some scope
> information from the source, leading to better autocompletion, among
> other things.
As I understand it, a common code model (like the one currently in use) can 
do that too. 

Moreover, having a common parser won't help you to write new code while 
refactoring. The syntax is different, and I don't think you can write code  
using the BNF syntax, you can only *read* it.

Regards,
Sylvain

[1] In fact, that's not entirely true for simple languages. The only 
language for which I'm sure it is true is C++. The guy who will produce a 
parsing algorithm able to parse C++ easily will be the compiler writers 
savior.




More information about the KDevelop-devel mailing list