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

Antlr 3 to Antlr 4 Migration Guide #464

Closed
UnquietCode opened this issue Feb 14, 2014 · 16 comments
Closed

Antlr 3 to Antlr 4 Migration Guide #464

UnquietCode opened this issue Feb 14, 2014 · 16 comments

Comments

@UnquietCode
Copy link

Upgrading from 2 to 3 had a nice migration guide (thanks for that). It would be helpful if there were one included for the upgrade from 3 to 4, either as a wiki page or referenced in the readme.

@parrt
Copy link
Member

parrt commented Feb 18, 2014

Hi. I think we should create one. ok, got something started here:

https://theantlrguy.atlassian.net/wiki/pages/viewpage.action?pageId=1900596

@parrt parrt closed this as completed Feb 18, 2014
@SomMeri
Copy link

SomMeri commented Feb 19, 2014

Thank you for the page, it already helped. I have one more question:

If hypothetical grammar does not uses ast ^(), but uses a lot of syntactic/semantic predicates, will it work the same way as before? What I mean is, predicates located in the beginning of the rule/alternative used to be hoisted, are they still going to be hoisted? And those in the middle of alternatives were never hoisted, is it still the case?

@sharwell
Copy link
Member

There is no more "hoisting" in the fashion that ANTLR 3 had it. Predicates located at the left edge of a decision (i.e. the left edge of a rule or block with more than one alternative) are evaluated as part of making that decision. Other predicates are ignored.
[parrt edit: others are ignored as part of decision. They are still evaluated during the parse.]

@SomMeri
Copy link

SomMeri commented Feb 19, 2014

@sharwell Thank you.

@miho
Copy link

miho commented Feb 19, 2014

Thanks for starting the migration guide. Just tried to construct my own grammar. It was damn easy. ANTLR 4 scares me. It just works :)

You mention that ASTs are no longer possible. What should I do if i'd like to write a compiler. Are parse trees equivalent to ASTs? Some additional hints on this topic would be great.

@parrt
Copy link
Member

parrt commented Feb 19, 2014

For writing a compiler, either generate LLVM-type static-single-assignment form stuff or construct an AST from the parse tree or using actions in grammar, turning off auto-parse-tree construction.

@UnquietCode
Copy link
Author

Thanks this is nice.

@parrt
Copy link
Member

parrt commented Feb 19, 2014

Updated the wiki page a bit more with links etc...

@vegtelenseg
Copy link

I am planning on upgrading to V4 from V3, I tried following the link Terence shared, but seemingly it does not exist anymore. Is there any source that I could follow to complete this upgrade?

Thanks in advance.

@parrt
Copy link
Member

parrt commented Apr 20, 2016

all doc has moved to repo https://github.com/antlr/antlr4/tree/master/doc not sure how much info on upgrading is there.

Try the faq https://github.com/antlr/antlr4/blob/master/doc/faq/general.md

@vegtelenseg
Copy link

I read through it and unfortunately did not find what's pertinent to what I am trying to do. I have asked a question here though, that is specific to what I am struggling to solve. http://stackoverflow.com/questions/36858750/converting-from-antlr3-to-antlr4

@ericvergnaud
Copy link
Contributor

The best place for discussion is the google group.

Le 26 avr. 2016 à 19:12, Siyanda notifications@github.com a écrit :

I read through it and unfortunately did not find what's pertinent to what I am trying to do. I have asked a question here though, that is specific to what I am struggling to solve. http://stackoverflow.com/questions/36858750/converting-from-antlr3-to-antlr4 http://stackoverflow.com/questions/36858750/converting-from-antlr3-to-antlr4

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub #464 (comment)

@filipegmiranda
Copy link

Hi @ericvergnaud - can you share the google group in here?

@ericvergnaud
Copy link
Contributor

ericvergnaud commented Sep 25, 2017 via email

@ArsenShnurkov
Copy link

The link from the comment #464 (comment) is no longer valid. Where one can find the migration guide now ?

@parrt
Copy link
Member

parrt commented Oct 9, 2017

It doesn't look like anything exists beyond that faq entry

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

No branches or pull requests

9 participants