Editor questions/feedback

I'm poking around MPS looking to use it as a formula editing  system (I see you have jetbrains.mps.formulaLanguage, cool!).

In looking at the editor functionality, I started a new model instance using the baseLanguage to mess with building expressions, and have a couple questions:

If I try to type a statement in a method:

3.5 + 4;

I have to 'auto-complete' non-terminals '<x.y>' before I can type in '3.5' and have it be recognized correctly - UGH!  Strangely enough if I do:

double foo = 3.5 + 4;

the '3.5' gets recognized correctly by just typing it in directly.

Also, trying to add parens '(' ')' around an expression is really confusing, I can't just go to the beginning of the '3.5' and type a '(' and the end of the '4' and add a ')'.  

It seems like a bit more free-form parsing would help a lot.

Furthermore - is there any way to limit the auto-complete to 'terminal' (vs non-terminal) choices?  I think it's pretty confusing to an end-user writing in the DSL to filter out all the junk.

Thanks!

0
4 comments
Avatar
Permanently deleted user

Scott Royston wrote:

I'm poking around MPS looking to use it as a formula editing  system (I see you have jetbrains.mps.formulaLanguage, cool!).

In looking at the editor functionality, I started a new model instance using the baseLanguage to mess with building expressions, and have a couple questions:

If I try to type a statement in a method:

3.5 + 4;

I have to 'auto-complete' non-terminals '<x.y>' before I can type in '3.5' and have it be recognized correctly - UGH!  Strangely enough if I do:

double foo = 3.5 + 4;

the '3.5' gets recognized correctly by just typing it in directly.

If you type double d = 3.54 without pressing controlspace you will got

what you want.

Also, trying to add parens '(' ')' around an expression is really confusing, I can't just go to the beginning of the '3.5' and type a '(' and the end of the '4' and add a ')'.  

It seems like a bit more free-form parsing would help a lot.

To surround some expression with parens you can select the whole

expression (use controlup, controldown keys) and press controlaltt.

Popup menu will appear where you can select (expr) item.

In baseLanguage we have many improvements that help you edit code.

for example if you have expression like this

int a = 3;

you can transform it to

int a = 3 + 2;

in such a way ( | means cursors)

int a = 3|;

space, +, enter

We call this right transform.

You can change sign in 3 + 2 by pressing control+space if cursor in under +.

Or you can select expression press controlaltt and.

We continously working on such improvments.

0
Avatar
Permanently deleted user

Scott Royston wrote:

Also, trying to add parens '(' ')' around an expression is really confusing, I can't just go to the beginning of the '3.5' and type a '(' and the end of the '4' and add a ')'.  

It seems like a bit more free-form parsing would help a lot.

Free-form parsing isn't good idea because if you code contains some

domain specific stuff for example sum or integral it is hard to parse it

and such solution will hardly be generic.

0
Avatar
Permanently deleted user

Can you be more specific?  From a users perspective, I think simply adding '(', ')' around an expression is by far the most intuitive editing mechanism.  

I can't imagine having excel formula editing require you to:

crtl-up, ctrl-alt-t, select '(expr)' (which is really just an implementation detail non-terminal of the abstract syntax tree).

in order to add parens.

Why is the parsing solution not generic?  When I define a structure, it seems to me I'm essentially defining a grammar.  Then I should be able to use a 'generic' algorithm like incremental GLR to help build the AST...  Kinda like what I assume Intellij does with java code...

0

Remark about formulaLanguage.

>> If I try to type a statement in a method:

>> 3.5 + 4;

Most likely this and rest of the post are not related to formulaLanguage.

This language has been designed in course of building demos for Fowler's article on Language Frameworks. In the "agreement" demo the agreementLanguage extends (or includes ? We don't have term for that) the formulaLanguage: some of its concepts extends concepts from formulaLanguage.

For instance: concept EventVariableReference extends formulaLanguage.Expression

As result, formulas can't be used in models written in the agreementLanguage.

Note, that the formulaLanguage is half-done and not integrated with baseLanguage at all.

0

Please sign in to leave a comment.