Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-core-dev] Prototype AST2 available in cdt_ast2

On Mon, 20 Sep 2004 16:23:19 -0400, Douglas Schaefer <dschaefe@xxxxxxxxxx> wrote:

Hey gang,

I've taken a quick stab at a prototype implementation of the new AST. This work, of course, is being done on the cdt_ast2 branch. I have created a
new JUnit test class AST2Tests in core.tests. The AST interface and
factory class are in org.eclipse.cdt.core.parser.ast2 in the parser
folder. The AST implementation, including a source element requestor to
reuse our parser to create the AST, are in
org.eclipse.cdt.internal.core.parser.ast2.

So far, I am just parsing "int x;", but it lets me get a feel for the
architecture and applicability of the AST.

Any feedback is appreciated, knowing of course this is a pretty rough run
at it. Discussion of this feature is being done at:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=57816.

Cheers,
Doug Schaefer, IBM's Eclipse CDT Architect
Ottawa (Palladium), Ontario, Canada

Hi there,

I'm quite new to this game (that is, to Eclipse), so forgive me if I'm going out the wrong branch. I have

I read through you paper and the basic design seems quite good, but I?m not clear on some distinctions between difference kind of nodes, e.g.: What is the difference between a variable and an identifier? And what is the difference between a reference and an identifier?

Another thing that I?m more concerned about is the extensibility of the AST. The current design is very focused on languages in the Algol family; which is a good starting point but (IMHO) to be practical, the design need to be extended to handle a wider domain of languages.

My reasoning goes: The AST is intended to be used for refactoring purposes in, at least, C/C++ projects and in addition "easy" extensions to other languages (such as Ada, Pascal, Modula-2, etc.) So, to be useful there have to be methods to handle at least the following language constructions:
- tasks in Ada (which might not be a big problem)
- macros in C/C++ (I can't see any support for that kind of object)
- grammar rules in Bison (this is commonly used in C/C++ projects)
- patterns and actions in Flex (also common in C/C++ projects)

The last two I find most interesting since Bison and Flex are very different from C and C++ and are commonly used in C/C++ projects. I believe that designing the AST so that it is possible to handle Bison and Flex specifications would help creating a AST design that is language independent enough to be able to be used widely.

So, I'm interested about how to handle Yacc/Bison and Lex/Flex specification, allowing Eclipse to refactor and generate code for these. Provided a suitable AST design is developed, I could volunteer to write parsers for both Lex and Yacc specifications (on my personal time).

Best wishes,
Mats Kindahl
--
IAR Systems AB
Box 23051 / Islandsgatan 2 / SE-750 23 Uppsala
Sweden

Tel:    +46 18 16 78 79
Fax:    +46 18 16 78 38
E-mail: mats.kindahl@xxxxxx


Back to the top