|
|
|
Re: call interpreter [message #735024 is a reply to message #735006] |
Mon, 10 October 2011 16:51 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
On 10/10/11 5:58 PM, samir wrote:
> I want to run from the IDE
> Where can I find examples?
You find all of Eclipse/b3 in it's git repository at eclipse. (It is at
github as well. https://github.com/eclipse/b3).
The core evaluator is here:
https://github.com/eclipse/b3/blob/master/org.eclipse.b3.backend/src/org/eclipse/b3/backend/evaluator/B3BackendEvaluator.java
You will find different polyporphic methods for calls and evaluation.
Here is an example:
public Object evaluate(BOrExpression o, BExecutionContext ctx) throws
Throwable {
if(Boolean.TRUE.equals(doEvaluate(o.getLeftExpr(), ctx)))
return Boolean.TRUE;
return doEvaluate(o.getRightExpr(), ctx);
}
The BExecutionContext provides access to the execution stack (among
other things). Exactly how b3 does this is probably not of much value to
you, but you may find it useful to look at some things are done.
In
https://github.com/eclipse/b3/tree/master/org.eclipse.b3.build.ui/src/org/eclipse/b3/build/ui/commands
there are several different ways shown how to run things from within the
IDE using a wizards (ask user for some values that are injected into the
evaluation of the DSL), etc. This includes popping dialogs with the
result, output to console etc. Again, this is not written to be intended
as some framework for others to use, but you may find useful things, and
may save you some time vs. figuring everything out from scratch.
Regards
- henrik
|
|
|
Powered by
FUDForum. Page generated in 0.03048 seconds