[il-antlr-interest: 32555] [SPAM] [antlr-interest] [SPAM]
http://visoryga.justicewasgreen.com/pybaxa.html List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups il-antlr-interest group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
[il-antlr-interest: 32560] [antlr-interest] question about antlr
Hi all, I have bought the ANTLR book in order to learn ANTLR better, but I still don't get how to fix one thing. I hope you can help me with that. I have a grammar that is used to parse our custom formula format to an Excel formula. So when filling an Excel worksheet the string entered is something like '$C{D,.,.,.+1}' which means 'one cell right from the current cell'. You will understand that eventually we will get something like '$C{D,.,.,.+1} + $C{D,.,.,.+2}', so add up the value of the first cell right and the second cell right (in Excel when we are at A1 this results in '=B1 + B2'. The problem is this: In the grammar I cannot find a way to 'eat up' the text between two 'eca_kolom_expressie' strings (the '$C{...}' part). I already tried 'EXCEL_FRAGMENT' in a hundred ways, but none of them seemed to work. ('TILDE (options {greedy=false;} : .) TILDE' seems to work, but when removing the TILDEs it stops working) I have included the grammar. Can you point me in the right direction? Regards, Patrick Hofman Senior Consultant Invantive B.V. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups il-antlr-interest group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
[il-antlr-interest: 32562] Re: [antlr-interest] question about antlr
And now the grammar From: Patrick Hofman Sent: donderdag 26 mei 2011 15:35 To: antlr-interest@antlr.org Subject: question about antlr Hi all, I have bought the ANTLR book in order to learn ANTLR better, but I still don't get how to fix one thing. I hope you can help me with that. I have a grammar that is used to parse our custom formula format to an Excel formula. So when filling an Excel worksheet the string entered is something like '$C{D,.,.,.+1}' which means 'one cell right from the current cell'. You will understand that eventually we will get something like '$C{D,.,.,.+1} + $C{D,.,.,.+2}', so add up the value of the first cell right and the second cell right (in Excel when we are at A1 this results in '=B1 + B2'. The problem is this: In the grammar I cannot find a way to 'eat up' the text between two 'eca_kolom_expressie' strings (the '$C{...}' part). I already tried 'EXCEL_FRAGMENT' in a hundred ways, but none of them seemed to work. ('TILDE (options {greedy=false;} : .) TILDE' seems to work, but when removing the TILDEs it stops working) I have included the grammar. Can you point me in the right direction? Regards, Patrick Hofman Senior Consultant Invantive B.V. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address eca_column_expressions.g Description: eca_column_expressions.g -- You received this message because you are subscribed to the Google Groups il-antlr-interest group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
[il-antlr-interest: 32565] Re: [antlr-interest] question about antlr
Hi Patrick, I have a hard time understanding what it is you're trying to do. Instead of springing the entire grammar on us (or me), could you extract only those rules that are causing the problem(s)? And could you include some example input you'd like to match/parse? Regards, Bart Kiers. On Thu, May 26, 2011 at 4:04 PM, Patrick Hofman patrick.hof...@invantive.com wrote: And now the grammar From: Patrick Hofman Sent: donderdag 26 mei 2011 15:35 To: antlr-interest@antlr.org Subject: question about antlr Hi all, I have bought the ANTLR book in order to learn ANTLR better, but I still don't get how to fix one thing. I hope you can help me with that. I have a grammar that is used to parse our custom formula format to an Excel formula. So when filling an Excel worksheet the string entered is something like '$C{D,.,.,.+1}' which means 'one cell right from the current cell'. You will understand that eventually we will get something like '$C{D,.,.,.+1} + $C{D,.,.,.+2}', so add up the value of the first cell right and the second cell right (in Excel when we are at A1 this results in '=B1 + B2'. The problem is this: In the grammar I cannot find a way to 'eat up' the text between two 'eca_kolom_expressie' strings (the '$C{...}' part). I already tried 'EXCEL_FRAGMENT' in a hundred ways, but none of them seemed to work. ('TILDE (options {greedy=false;} : .) TILDE' seems to work, but when removing the TILDEs it stops working) I have included the grammar. Can you point me in the right direction? Regards, Patrick Hofman Senior Consultant Invantive B.V. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups il-antlr-interest group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
[il-antlr-interest: 32566] [antlr-interest] Nasty LHS expression
I am having a difficult time distinguishing two legal lines of code: ID = expression and ID(exp1, exp2, ...) = expression I tried this rule: stat: expr NEWLINE- expr | (ID OPENP .* CLOSEP GETS) = ID OPENP actualParameters CLOSEP GETS expr NEWLINE - ^(INDEX ID OPENP actualParameters CLOSEP expr) | ID GETS expr NEWLINE - ^(GETS ID expr) | NEWLINE - ; But it says that alternatives 2 and 3 can never be matched. How do I reactivate 2 and 3? DMS David M. Smith http://www.cc.gatech.edu/fac/David.Smith Georgia Institute of Technology, College of Computing Sent from my ASR-33 Teletype List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups il-antlr-interest group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
[il-antlr-interest: 32567] Re: [antlr-interest] Nasty LHS expression
Hi David, Can an `expr` match something that starts with `ID OPENP` and/or `ID GETS`? Perhaps you can post your entire grammar? Or at least the `expr` rule? Regards, Bart. On Thu, May 26, 2011 at 7:02 PM, David Smith david.sm...@cc.gatech.eduwrote: I am having a difficult time distinguishing two legal lines of code: ID = expression and ID(exp1, exp2, ...) = expression I tried this rule: stat: expr NEWLINE- expr | (ID OPENP .* CLOSEP GETS) = ID OPENP actualParameters CLOSEP GETS expr NEWLINE - ^(INDEX ID OPENP actualParameters CLOSEP expr) | ID GETS expr NEWLINE - ^(GETS ID expr) | NEWLINE - ; But it says that alternatives 2 and 3 can never be matched. How do I reactivate 2 and 3? DMS David M. Smith http://www.cc.gatech.edu/fac/David.Smith Georgia Institute of Technology, College of Computing Sent from my ASR-33 Teletype List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups il-antlr-interest group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
[il-antlr-interest: 32568] Re: [antlr-interest] Why stream name can't be printed out when error occurs(ANTLR C)?
For development, I handled tree grammar error reporting with the following code. It simply searches back in the token stream until it hits an input token and uses that for location information. I also print out the token index offset between the error token and the reporting token so I get an idea of where the error occurred. Note that I stopped changing this as soon it was working enough to allow debugging the tree grammar so don't expect much. pANTLR3_COMMON_TOKEN searchToken = NULL; unsigned int testIndex = 0; if(ex-index 0) { testIndex = ex-index - 1; pANTLR3_BASE_TREE searchBaseTree = thisTreeNodeStream-get(thisTreeNodeStream,testIndex); searchToken = searchBaseTree-getToken(searchBaseTree); //If UP token if(errorToken-type == 3) { //Go back in the stream until we hit a token that is not UP and has a column not -1 while(searchToken-type == 3 || searchToken-charPosition == -1) { testIndex--; //FIXME - Maybe dangerous? searchBaseTree = thisTreeNodeStream-get(thisTreeNodeStream,testIndex); searchToken = searchBaseTree-getToken(searchBaseTree); //printf(searchToken-toString %s\n,searchToken-toString(searchToken)-chars); } } //If DOWN token else if(errorToken-type == 2) { //Go back in the stream until we hit a token that is not UP while(searchToken-type == 2) { testIndex--; //FIXME - Maybe dangerous? searchBaseTree = thisTreeNodeStream-get(thisTreeNodeStream,testIndex); searchToken = searchBaseTree-getToken(searchBaseTree); // printf(searchToken-toString %s\n,searchToken-toString(searchToken)-chars); } } //If no column info(imaginary token?) else if(errorToken-charPosition == -1) { //Go back in the stream until we hit a token that is not UP and has a column not -1 while(searchToken-type == 3 || searchToken-type == 2 || searchToken-charPosition == -1) { testIndex--; //FIXME - Maybe dangerous? searchBaseTree = thisTreeNodeStream-get(thisTreeNodeStream,testIndex); searchToken = searchBaseTree-getToken(searchBaseTree); //printf(searchToken-user1 %d\n,searchToken-user1); // printf(searchToken-type %d\n,searchToken-type); // printf(searchToken-toString %s\n,searchToken-toString(searchToken)-chars); } } else { searchToken = errorToken; } } //This must be the first node in the tree else { searchToken = errorToken; } List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups il-antlr-interest group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.