help-bison
[Top][All Lists]
Advanced

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

Re: Union Type Object problem


From: Frank Heckenbach
Subject: Re: Union Type Object problem
Date: Fri, 13 Aug 2004 02:58:58 +0100
User-agent: semail 20040101

Laurence Finston wrote:

> One of the most clever things about Metafont is that it can solve linear
> equations and perform certain other operations with unknown quantities.  For
> example, the following is valid MF code:
> 
> a = 2b;
> b = .5c + 1;
> c = 3;
> show a;
> --> 5 
> show b;
> --> 2.5 
> 
> Since `a', `b' and `c' aren't declared, MF considers them to be of type
> `numeric'.  Operations on variables of other types with unknown values are
> also allowed.

That's not really solving linear equations, just plain constant
arithmetic, with automatic reordering of declarations, or lazy
evaluation. Maybe it's just this example, though, and it can solve
linear equations in fact -- does this work?

a = 2b;
b = a - 3;
show a;
--> 6

> In MF, `path a' can be a `declaration' or a
> `boolean expression', e.g.,
> 
> path a; % `declaration'
> 
> if (path a) % `boolean expression'
> ...
> fi
> 
> I'm not even going to try to implement this using Bison.  Maybe it would work,
> but I think it's so likely not to, that I'm going to just use `is_path', etc.,
> for the `boolean expressions' instead.

Since the context it clearly distinct (provided `if' is a keyword),
this should be no problem at all.

Frank

-- 
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)




reply via email to

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