bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GMP parser


From: Hans Aberg
Subject: GMP parser
Date: Thu, 26 Apr 2001 13:10:24 +0200

At 08:20 +1000 2001/04/26, Kevin Ryde wrote:
>> In addition, I am now making a Flex/Bison parser, making it easy to test
>> the different arithmetic operations (calculator style).
>
>Have a look at demos/calc.y and calclex.l if you haven't already.
>Very minimal, but better than a poke in the eye with a burnt stick.
>:-)

The also very minimal parser I made compiles under C++. It also parses
rational, fixed, and floating point numbers (fixed produces a floating as
semantic value).

I design it very deliberately to be as a test of the GMP library features
with as few other features as possible.

Note that in the calclex.l file, one do a table binary search, as it is
sorted -- it is of course of no practical importance with such a small
table. The straightforward
  "abs"    { return ABS; }
  "bin"    { return BIN; }
  ...
is probably also much faster, as Flex should translate it into a one
character look-ahead NFA.

  Hans Aberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]