Reputation: 1326
What is the correct way of writing a grammar in ANTLR for language that is right-to-left such as Arabic or Hebrew? Do I write the tokens and rules in the grammar left-to-right and then create InputStream that fills in the characters in the Lexer right-to-left?
Upvotes: 1
Views: 210
Reputation: 53337
RTL reading is only a presentation, while in memory (and that is what counts for the ANTLR4 lexer) the characters are stored in increasing memory address order, just like for any other language. ANTLR4 is now fully Unicode aware and you should be able to write your rules in any language that is supported by Unicode (for both: the grammar rule names as well as the lexer content).
Upvotes: 2