python multilibgual : Issue with Modifying Python Grammar for Multiple Languages - MemoryError and Parser

27 views Asked by At

Hello Stack Overflow community,

I'm currently working on a project where I'm attempting to make Python multilingual. Initially, I successfully modified the Python grammar for two languages (English and Hindi), and everything worked as expected. However, when I extended my modifications to include a third language (Tamil), I encountered issues during compilation.

Here is a simplified version of the relevant grammar change that works for two languages:

while_stmt: ( 'while' | 'जबतक' ) namedexpr_test ':' suite [( 'else' | 'तद' ) ':' suite]

This allows me to use the Hindi keyword "जबतक" for while loops successfully. However, when I try to include a third language, Tamil, by modifying the grammar as follows:

while_stmt: ( 'while' | 'जबतक' | 'போது' ) namedexpr_test ':' suite [( 'else' | 'तद' ) ':' suite]

I encounter the following error during compilation:

s_push: parser stack overflow
MemoryError

This issue seems to be related to a memory error and a parser stack overflow. I've reviewed my changes, and I suspect that the increased complexity of the modified grammar might be causing these problems.

I would appreciate any insights or suggestions on how to address this issue.

0

There are 0 answers