Rust Target

302 views
Skip to first unread message

Stuart Dootson

unread,
Jun 21, 2017, 5:51:52 AM6/21/17
to antlr-discussion
I'm interested in using Antlr to generate parsers to use from Rust. I could possibly use the C++ target (although I haven't used it much - most of my Antlr experience is with Antlr 2 and its C++ target - since around 2003!), but a Rust target would be a) likely easier to integrate, and b) a 'fun' learning experience.

So - are there any documented pointers about what needs to be in place for a new target. Obviously there's codegen from Antlr (using StringTemplate, I presume?) and then the runtime... And I guess the interface to Antlr through the generator places requirements/constraints on the generated code (and thus the supporting runtime)?

Any suggestions, pointers etc are welcome...

Stuart Dootson

Eric Vergnaud

unread,
Jun 21, 2017, 11:32:47 AM6/21/17
to antlr-discussion
Here is the path I followed to create the JavaScript and Python runtimes.
I started by implementing (in Java) a JUnit test integration for the Rust runtime (see runtime-testsuite).
This helped me start with simple Lexer tests, and gradually grow in complexity.
Then I gradually migrated the Java runtime to Python 3 (the types were very helpful).

I didn't have much choice then, but today you can pick any existing runtime as a source to migrate to Rust.
From what I can see at a glance on the Rust web site, JavaScript could be the best one.

Stuart Dootson

unread,
Jun 21, 2017, 6:50:57 PM6/21/17
to antlr-di...@googlegroups.com
Thanks for that - sounds like a good approach

-- 
Stuart Dootson
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rutger Rauws

unread,
Jan 17, 2018, 9:56:51 AM1/17/18
to antlr-discussion
Hi Stuart, did you make any progress on a Rust target? Otherwise I might look into it.
Reply all
Reply to author
Forward
0 new messages