in reply to Re: Seeking Advice: Writing a parser
in thread Seeking Advice: Writing a parser

Just to clarify your first point; for the benefit of those w/o an education from the American public schools ;-) it's PEMDAS!

  1. Parantheses (I would imagine trig functions go here)
  2. Exponents (I would imagine logarythms go here)
  3. Multiplication, Division
  4. Addition, Subtraction

For the second part you can be smart. Declare your parser as not lazy, then if mx has not yet been seen but m and x have there is implicit multiplication. On the gripping hand say m, x, and mx are defined. I'd opt for mx and force explicit multiplcation for m and x.

--
perl -pe "s/\b;([st])/'\1/mg"

  • Comment on Re: Re: Seeking Advice: Writing a parser