Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

New parser model for Code completion

<< < (6/16) > >>

rickg22:
I see. Well in that case, I'd rather have a hardwired state table than having the full C++ code generated for different languages (which is what i'm trying to avoid, doing that makes the code very hard to maintain)

thomas:

--- Quote from: rickg22 on December 12, 2005, 07:20:13 pm ---Yes, I see. But if we use a C++ generator, it means we'll have to recompile after adding all the language modules.
--- End quote ---
And in the case of ANTLR, this means you have to do that using Java...

takeshimiya:

--- Quote from: thomas on December 12, 2005, 08:40:55 pm ---And in the case of ANTLR, this means you have to do that using Java...

--- End quote ---

You only have to use Java if you're using the Java output.
If you're using the C++ output you'll use C++.

Also ANTLR haves support (grammars and lexers) for parsing a lot of languages on earth.

rickg22:
Perhaps making our own customized model would be easier. I mean, we can deduce the "C++ wannabe model" :lol: from Yiannis' code, and later we can expand it to other languages.

I looked at Yiannis' tokenizer (which would be better called 'parser', don't you love all that confusing nomenclature? :P ), and it has more or less a good model for deciding when to add a description for a function, keeps track of opening and closing brackets, etc.

Some of that functions can't be replicated (easily) with a standard FSA, so i'll add a new item to the table: "action". So instead of having only a "next state" given a state and an input, we'll have both an action, and a next state. That'll facilitate things.

EDIT: But it all depends on whether ANTLR has a generator, or it's more a generalized-parser model.

takeshimiya:
ANTLR is a LL(k) lookahead based parser generator. It generates a recursive descent parser from the grammar.
You can see how an example of how to create a parser from the start here.

Elkhound is a GLR Parser Generator. The parsers it generates use the Generalized LR parsing algorithm. GLR works with any context-free grammar.

Boost Spirit is an object oriented recursive descent parser framework implemented using template meta-programming techniques. Expression templates allow us to approximate the syntax of EBNF completely in C++. Parser objects are composed through operator overloading and the result is a backtracking, top down parser that is capable of parsing rather ambiguous grammars.
The Spirit framework enables a target grammar to be written exclusively in C++. Inline EBNF grammar specifications can mix freely with other C++ code and, thanks to the generative power of C++ templates, are immediately executable.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version