Need brutal review / tips [message #784131] |
Fri, 27 January 2012 05:01 |
Eric Springer Messages: 5 Registered: January 2012 |
Junior Member |
|
|
I'm working on a compile-to-js language, the description is here:
github.com/espringe/staticscript/
So far, I've only been working on the grammar, which is here:
github.com/espringe/staticscript/blob/master/staticscript/src/espringe/StaticScript.xtext
And I'm pretty close(ish) to done, but I can't help feel like I'm doing it really, really wrong.
If someone could look at that, and tell me everything that comes to mind, I'd highly appreciate it.
The thing I feel I'm doing especially wrong, is how I do cross links. Like all variable, types and function goes through "DefinedName" so I can cross link against it. The upside is it works, the downside is -- if in a particular place in my Grammar I *know* I need a type -- I am used "DefinedName" which would allow people to enter a variable for instance.
Also from the attached screenshot, you can see my "outline" view is an absolute total mess. What can I do to my grammar to preven this?
Thank you for reading!
Eric
( sorry, can't make stuff a link, till I've made 5 posts)
P.S. Absolutely fantastic work on XText. I can't imagine a tool done better (other than perhaps finding all errors earlier than ANTLR)
-
Attachment: yuck.png
(Size: 57.81KB, Downloaded 119 times)
[Updated on: Fri, 27 January 2012 05:03] Report message to a moderator
|
|
|
Re: Need brutal review / tips [message #784570 is a reply to message #784131] |
Fri, 27 January 2012 18:04 |
|
Hi,
Welcome to Xtext!
first of all you do not have to do everything "in the grammar".
you can adapt the cross references with custom scoping / IQualifiedNameProvider
you can adapt the outline as well (the structure as well as the label)
your ScopeProvider is empty. You have no custom IQualifiedNameProvider bound.
Nor did you changes to your LabelProvider and OutlineTreeProvider.
next step would be to read the documentation (and maybe some blogs)
on topics like Scoping to see what you can do.
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.05787 seconds