David-Sarah Hopwood wrote: > My advice would be to use a conventional operator precedence grammar, > as below (now that I've spent the time to fix the grammar I might as > well give you this part of it), and check types after parsing. > [...] > logical_expression : not_expression (logical_op not_expression)* ; [...] > numerical_expression : primary_expression > (numOp primary_expression)* ;
Incidentally, this treats AND and OR as having the same precedence, and similarly for all numeric operators. That is probably not what you want in practice; the grammar should have a separate rule for each precedence level. -- David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com
signature.asc
Description: OpenPGP digital signature
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
