Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ANTLR v4.6 grammars #40

Open
amlajmi opened this issue Dec 19, 2016 · 14 comments
Open

Support ANTLR v4.6 grammars #40

amlajmi opened this issue Dec 19, 2016 · 14 comments

Comments

@amlajmi
Copy link
Contributor

amlajmi commented Dec 19, 2016

Evaluate the JavaScript target of ANTLR v4.6 and provide support for such grammars in the static web app scenario (no Xtext in the backend).

@dpatil-gmcs
Copy link

@amlajmi

Could you please let us know ETA for this enhancement? That will be great help.

Thanks.
Deepak.

@amlajmi
Copy link
Contributor Author

amlajmi commented Mar 16, 2017

Still in progress, the introduction of Node.js in ANTLRv4 JavaScript target is bringing additional headache. Hopefully, it will be made publicly available in v0.9.2 by the end of March.

@rimmartin
Copy link

Would this be with the lexer and parser in separate files or combined?

@amlajmi
Copy link
Contributor Author

amlajmi commented Oct 16, 2017

Separate files, jut like the current ANTLR v3.3 integration.

  • Guys, how many of you want to have Node.js as backend?
  • Anyone interested in a Spring Boot/Angular generator?

@rimmartin
Copy link

rimmartin commented Oct 18, 2017

You need antlr4 in client?

I believe the antlr4 runtime https://github.com/antlr/antlr4/blob/master/doc/javascript-target.md allows running with or without nodejs. To use without nodejs the require needs a replacement. https://github.com/letorbi/smoothie/tree/master/standalone is the updated one. I will try it with one of my small experimental apps. Also curious if http://requirejs.org/ would work as well.

Since ace has it's own require some coding to have both is needed

...
importScripts("http://roger-g74sx:9080/worker-base.js");
// load nodejs compatible require
var ace_require = require;
require = undefined;
var Honey = { 'requirePath': ['/'] }; // walk up to js folder, see Honey docs
importScripts("http://roger-g74sx:9080/lib/require.js");
var antlr4_require = require;
require = ace_require;
...

I never tried their webpack suggestion but did stand up an antlr4 grammar with ace with require.js

@amlajmi
Copy link
Contributor Author

amlajmi commented Oct 19, 2017

I agree, the problem v4.6 has a strong depenency to Node.js, and the Honey stuff looks like a hack to make it work with ACE's require.js.

I think doing a clean integration with ACE requires to slightly modify the parser/lexer generator templates, which is possible with ANTLR, but as it needs a non negligible ammount of work, we don't want to do it just because it's cool (we've contributed a lot of stuff based on this philosophy so far :), and we'd like to get more feedback from developers before going further.

That said, if you make it work the clean way, it would be nice to integrate it to DSL Forge. Please feel free to open a pull request if you are interested.

@rimmartin
Copy link

Well it ain't happenin' fast via me lol. I get 2807 errors after getting the plugins projects into Eclipse. The pde dependencies are there. Eclipse EE thingy. And I'm not asking for anyone to help me with this. I have great intestinal fortitude for most tasks but for some reason Eclipse is a complete pita to me.

One question; how vital is Java and Eclipse to the dsl forge's purposes? Could it be a webapp itself?

@amlajmi
Copy link
Contributor Author

amlajmi commented Oct 22, 2017

Of course yes, we experimented something like this before, the idea was to setup an ANTLR Web IDE, based on DSL Forge and other open-source projects. We were able to migrate parts of the tooling (Eclipse) to the runtime (the webapp), but the backend was still in Java.

@rimmartin
Copy link

Ah very interesting. In a branch or other project?

@amlajmi
Copy link
Contributor Author

amlajmi commented Oct 22, 2017

For now, it's an internal prototype, we did not publish the code as it needs additional care to make it compatible with EPL. We would love to take this direction, but unfortunately, this is not our top priority now, unless there are good reasons. Alternatively, you could get in touch with the professional support if you want to share your usecase/motivations and discuss how to dispatch the efforts.

Anyone else interested in this enhancement is more than welcome!

@rimmartin
Copy link

Hi @amlajmi, I've learned more about what you were referring to ace needing modification.

As you know ace is a one line-at-a-time lexer/highlighter and currently isn't built for grammars. I'm looking around to see if anyone is forking and attempting to redo the core of ace and looking at other possibilities of going from antlr v4 to a rich text editor in javascript

@amlajmi
Copy link
Contributor Author

amlajmi commented Nov 1, 2017

Hi @rimmartin ,

if anyone is forking and attempting to redo the core of ace

I think it's a good practice to keep the runtime based on a standard Ace distribution, even with the issue of multiline parsing, which is another known problem. Maybe the effort should be done on the Antlr side; changing the template headers to use Ace require instead of Node require would be enough.

@rimmartin
Copy link

Oh I wasn't proposing forking forever but to put a pull request eventually to them. (Or see if anyone is already forking for this but their fork list is so huge ace's github won't display them)

I may try a pull request for using the same ace require to the antlr team as well. As you stated it is two issues.

Ace's mode getLineTokens is a limitation that my project can't live with since I'm even employing the multi lexer mode(https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md, a different concept than ace's language mode concept) capability with antlr v4

@amlajmi
Copy link
Contributor Author

amlajmi commented Nov 3, 2017

OK, I see. If you are using multiple lexers, I understand why you may need to process several lines at once, I guess something needs to be done here to make it work with your project. Anyway, let us know if you succeed in rebuilding Antlr v4, this would be awesome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants