2 Nov 2005 22:13:51 -0500

Related articles |
---|

What is correct way to describe this in BNF for an LL(1) parser donmackay@optushome.com.au (don) (2005-11-02) |

Re: What is correct way to describe this in BNF for an LL(1) parser mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2005-11-04) |

What is correct way to describe this in BNF for an LL(1) parser rici@ricilake.net (Rici Lake) (2005-11-04) |

Re: What is correct way to describe this in BNF for an LL(1) parser donmackay@optushome.com.au (don) (2005-11-08) |

Re: What is correct way to describe this in BNF for an LL(1) parser henry@spsystems.net (2005-11-12) |

From: | "don" <donmackay@optushome.com.au> |

Newsgroups: | comp.compilers |

Date: | 2 Nov 2005 22:13:51 -0500 |

Organization: | http://groups.google.com |

Keywords: | LL(1), question |

I'm trying to write a parser for mathematical equations (yes I know

other are a lot around but - as always - I feel none meet my

requirements; and anyway its a bit of fun!). The tool I'm using uses

BNF notation and is a LL(1) parser.

I can do everything I've needed to so far except for the absolute value

function (eg | expression |). The problem is that the expression can

expand back to this definition and, as it is simply stated now, the

parser does not appear to tell the difference between closing '|' and

the start of a nested expression. If I change the trailing "|" to

something like '@' then the whole thing works OK.

Is there a 'proper' way in BNF form to express this?

I know that there are several 'tricks' that are routinely used in this

sort of thing to allow the parser to maintain its strict LL(1) status

for other constructs, but how about this one?

BTW, I also have the more standard " ABS ( expression ) " version and

that gets me by for now, but I really would like the |...| notation as

well.

Thanks

Don

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.