Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » IMP » LPG
LPG [message #14914] Tue, 27 November 2007 15:55 Go to next message
Eclipse UserFriend
Originally posted by: dennis.huebner.gmail.com

Hello All!
Is it possible to use IMP without LPG?
regards,
user.
Re: LPG [message #14933 is a reply to message #14914] Wed, 28 November 2007 23:45 Go to previous messageGo to next message
Stan Sutton is currently offline Stan SuttonFriend
Messages: 121
Registered: July 2009
Senior Member
Dennis Hübner wrote:
> Hello All!
> Is it possible to use IMP without LPG?
> regards,
> user.

Yes, it is. In principle that is our intention. In practice we don't
have any special support for it, but it is still possible.

IMP is designed to access things like the parser, lexer, parse stream,
lex stream, AST nodes, and so on, through a set of interfaces that are
fairly abstract and generic, i.e., independent of the underlying parser
technology or AST representation. I think we still have a few
dependencies on some LPG-defined interfaces, but we're working to remove
those, and it is not necessary to use LPG to implement those interfaces
in any case.

There are two main IMP-defined interfaces through which the IMP
Universal Editor and the various IDE service implementations access the
parser and AST nodes. Those are

org.eclipse.imp.parser.IParseController;

org.eclipse.imp.parser.IASTNodeLocator

These are from the org.eclipse.imp.runtime project. You could start by
looking at those to get a feel for what is required in the way of parser
and AST support. Those refer to other relevant types.

For the most part, within the IMP framework classes, AST node types are
referenced as Objects or, in a few cases, as a fairly generic ASTNode.
This is a type that is currently defined by LPG (or in what LPG
generates), but it can be implemented in other ways. The details of
specific AST node types are not referenced in the IMP framework; those
are only needed within in the language-specific specializations of
various IDE services.

Many of the IDE service implementations rely on an AST visitor. IMP
doesn't define a visitor interface, but these service implementations
assume that an AbstractVisitor class can be obtained along with the AST
node types. (One of the nice features of LPG is that it will generate
both the AST node types and the AbstractVisitor

We're working to remove the remaining dependencies on LPG-defined types
and to improve aspects of the organization of the parser-related
capabilities. We are also still looking for a chance to write some
documentation about this! Your question will help to motivate us.

I hope this is at least enough to get you started. If you have any
further questions, please ask!

Best regards,

Stan

P. S. For an example of what gets generated with LPG, you can look in
the org.eclipse.imp.prefspecs project, in the
org.eclipse.imp.prefspecs.parser and
org.eclipse.imp.prefspecs.parser.Ast packages. If you want to use
another parser generator, then basically you would have to provide
something more or less like that. If you look into the x10.compiler
project (X10 is an extension of Java for parallel computing), you can
see an example where LPG was used to generate the parser but Polyglot
was used to represent the AST node types. Both of these projects are
available in the IMP repository.
Re: LPG [message #16397 is a reply to message #14933] Thu, 29 November 2007 09:15 Go to previous message
Eclipse UserFriend
Originally posted by: dennis.huebner.gmail.com

Hello Stan!

Thanks a lot for this very detailed answer!

> Yes, it is. In principle that is our intention. In practice we don't
> have any special support for it, but it is still possible.
I found out that is a long way between theory and practice :)

> IMP is designed to access things like the parser, lexer, parse stream,
> lex stream, AST nodes, and so on, through a set of interfaces that are
> fairly abstract and generic, i.e., independent of the underlying parser
> technology or AST representation. I think we still have a few
> dependencies on some LPG-defined interfaces, but we're working to remove
> those, and it is not necessary to use LPG to implement those interfaces
> in any case.

Yes, there are some direct dependency to LPG in impotent IMP-interfaces,
that is why I've asked this question. ;)


> We're working to remove the remaining dependencies on LPG-defined types
> and to improve aspects of the organization of the parser-related
> capabilities.

Is it still planed for June-October 2008 or a little bit earlier?


Actually I'm trying to marry IMP and Antlr and this LPG decencies are
sometimes really annoying.

Regards,
Dennis.

P.S.: Thanks for your tip with org.eclipse.imp.prefspecs-Project ;)
Re: LPG [message #568939 is a reply to message #14914] Wed, 28 November 2007 23:45 Go to previous message
Stan Sutton is currently offline Stan SuttonFriend
Messages: 121
Registered: July 2009
Senior Member
Dennis Hübner wrote:
> Hello All!
> Is it possible to use IMP without LPG?
> regards,
> user.

Yes, it is. In principle that is our intention. In practice we don't
have any special support for it, but it is still possible.

IMP is designed to access things like the parser, lexer, parse stream,
lex stream, AST nodes, and so on, through a set of interfaces that are
fairly abstract and generic, i.e., independent of the underlying parser
technology or AST representation. I think we still have a few
dependencies on some LPG-defined interfaces, but we're working to remove
those, and it is not necessary to use LPG to implement those interfaces
in any case.

There are two main IMP-defined interfaces through which the IMP
Universal Editor and the various IDE service implementations access the
parser and AST nodes. Those are

org.eclipse.imp.parser.IParseController;

org.eclipse.imp.parser.IASTNodeLocator

These are from the org.eclipse.imp.runtime project. You could start by
looking at those to get a feel for what is required in the way of parser
and AST support. Those refer to other relevant types.

For the most part, within the IMP framework classes, AST node types are
referenced as Objects or, in a few cases, as a fairly generic ASTNode.
This is a type that is currently defined by LPG (or in what LPG
generates), but it can be implemented in other ways. The details of
specific AST node types are not referenced in the IMP framework; those
are only needed within in the language-specific specializations of
various IDE services.

Many of the IDE service implementations rely on an AST visitor. IMP
doesn't define a visitor interface, but these service implementations
assume that an AbstractVisitor class can be obtained along with the AST
node types. (One of the nice features of LPG is that it will generate
both the AST node types and the AbstractVisitor

We're working to remove the remaining dependencies on LPG-defined types
and to improve aspects of the organization of the parser-related
capabilities. We are also still looking for a chance to write some
documentation about this! Your question will help to motivate us.

I hope this is at least enough to get you started. If you have any
further questions, please ask!

Best regards,

Stan

P. S. For an example of what gets generated with LPG, you can look in
the org.eclipse.imp.prefspecs project, in the
org.eclipse.imp.prefspecs.parser and
org.eclipse.imp.prefspecs.parser.Ast packages. If you want to use
another parser generator, then basically you would have to provide
something more or less like that. If you look into the x10.compiler
project (X10 is an extension of Java for parallel computing), you can
see an example where LPG was used to generate the parser but Polyglot
was used to represent the AST node types. Both of these projects are
available in the IMP repository.
Re: LPG [message #568962 is a reply to message #14933] Thu, 29 November 2007 09:15 Go to previous message
Eclipse UserFriend
Originally posted by: dennis.huebner.gmail.com

Hello Stan!

Thanks a lot for this very detailed answer!

> Yes, it is. In principle that is our intention. In practice we don't
> have any special support for it, but it is still possible.
I found out that is a long way between theory and practice :)

> IMP is designed to access things like the parser, lexer, parse stream,
> lex stream, AST nodes, and so on, through a set of interfaces that are
> fairly abstract and generic, i.e., independent of the underlying parser
> technology or AST representation. I think we still have a few
> dependencies on some LPG-defined interfaces, but we're working to remove
> those, and it is not necessary to use LPG to implement those interfaces
> in any case.

Yes, there are some direct dependency to LPG in impotent IMP-interfaces,
that is why I've asked this question. ;)


> We're working to remove the remaining dependencies on LPG-defined types
> and to improve aspects of the organization of the parser-related
> capabilities.

Is it still planed for June-October 2008 or a little bit earlier?


Actually I'm trying to marry IMP and Antlr and this LPG decencies are
sometimes really annoying.

Regards,
Dennis.

P.S.: Thanks for your tip with org.eclipse.imp.prefspecs-Project ;)
Previous Topic:LPG
Next Topic:IMP mentioned
Goto Forum:
  


Current Time: Thu Nov 27 21:24:04 GMT 2014

Powered by FUDForum. Page generated in 0.02758 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software