in reply to Seeking Advice: Writing a parser
Computer languages get around this by requiring explicit multiplication symbols: The expression above becomes b*(x+1) if multiplication is intended. Your example above indicates that you want implicit multiplication, and that can be very tricky. If you see something like y = mx, how will you know how to parse it? Is mx one variable, or is it the product of m and x? These are the sorts of side problems that you'll have to solve to build a parser that works the way you want it to.
You might want to consider first writing a parser for a simpler and less ambiguous language---say, arithmetic expressions involving only numerals, with explicit multiplication. Once you have some experience solving the simple problem, you can go back and embellish it to handle more complex expressions.
--
Mark Dominus
Perl Paraphernalia
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Seeking Advice: Writing a parser
by belg4mit (Prior) on Feb 17, 2002 at 06:07 UTC |