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

New parser model for Code completion

<< < (8/16) > >>

thomas:
Hmm... that reads almost like Sedgewick's book :)


Oh... lol

--- Quote ---Sedgewick, chapters 19-23
--- End quote ---

Michael:

--- Quote from: rickg22 on December 20, 2005, 07:26:20 pm ---Guys, look at this!

http://www.cee.hw.ac.uk/~alison/alg/lectures.html

I think these lectures will benefit us all.

--- End quote ---

Interesting lectures, even if a bit old :). Some external links are unfortunately broken :(.

Michael

grv575:
Wouldn't the ideal system do:

1.  use lexx to generate a lexer/tokenizer/fsm that would be run to tokenize the source files into tokens.
2.  yacc would then, given language tokens, parse them into valid language syntax and generate an abstract syntax tree (each node is a token - organized in a tree structure to reflect the language grammer - i.e. (x+5) +3 != x + (5 + 3) even though they have the same tokens - x, 5, 3).

So to add a different parser all that would need to be done is:
a) specify the lexx input file and run lexx on it - this produces a fsm
b) use yacc on a grammar specification based on the tokens lexx produces to produce the parser.

The parser will then parse the language specified and give you an abstract syntax tree to work with.  These tree nodes can be annotated with things like comments (although then it has to be agreed that comments must preced source lines unless they are on the same line or ...) or other attributes.

The tree will then be what codeblocks uses to iterate over to get the info it needs for code completion, find declaration/implementation, refactoring?, ...

CB wouldn't need to be recompiled to add a different language - just lexx & yacc run on the specification, then maybe an .xml config file edited which CB uses to determine which languages are available.

Isn't this the most robust & simplest solution to get up & running?

takeshimiya:

--- Quote from: grv575 on December 21, 2005, 12:54:55 am ---Isn't this the most robust & simplest solution to get up & running?

--- End quote ---

No, the most one I found is CodeStore, which in fact uses ANTLR C++ (which is a perfect replace for lexx/yacc/bison/etc)

If we use ANTLR, we get automatically these grammars done by the community:
-Full and mature, C++ supporting almost everything (templates, namespaces, etc)
-Phyton
-C#
-Java
-Pascal
-MySQL
-HTML
-CSS
-JavaScript
-Ada
-Verilog
-A lot more

And being that is a parser generator, it's intended to add any other language you want.

grv575:
So what's the issue with integrating antlr?  It sounds like the java ant makefile compiler mixed with LR parsing...

I've used JavaCC with JCUP before for writing a compiler so I'd be willing to help integrate if needed.
So the output of antlr is a c++ parser or...?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version