cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/14/04:17:59

From: Christoph Kukulies <kuku AT gilberto DOT physik DOT rwth-aachen DOT de>
Message-Id: <199702140904.KAA03761@gilberto.physik.rwth-aachen.de>
Subject: Re: Bison return values
In-Reply-To: <5dof4o$en8@news00.btx.dtag.de> from Gunnar Beushausen at "Feb 11, 97 00:39:52 am"
To: GBeushausen AT t-online DOT de (Gunnar Beushausen)
Date: Fri, 14 Feb 1997 10:04:38 +0100 (MET)
Cc: djgpp AT delorie DOT com
Reply-To: Christoph Kukulies <kuku AT gilberto DOT physik DOT rwth-aachen DOT de>
MIME-Version: 1.0

> Hi!
> 
> I've a big problem. I wan't to write a getpixel routine for my own BASIC
> interpreter GBasic, using BISON. The problem is, i don't know how to
> define a BISON function that returns a value. 
> 
> The Syntax should be like:
> 
> a = getpixel 100, 100
> I tried
> 
> | GETPIXEL expression',' expression,
> that won't work, just like
> | expression '=' GETPIXEL expression',' expression.
                                      ^ space here

Does your lexer separate the tokens properly?

Your left hand side must be something like an identifier
and you should have a syntax definition for an assignment
like:

assignment: identifier '=' function
            { $1 = $3; }

function:  GETPIXEL  expression ',' expression
            { $$ = getpixel($2,$4); }


> 
> Can somebody please help me?
> 
> ---
> Gunnar Beushausen
> GBeushausen AT t-online DOT de
> http://www.hof.de/~gbasic
> 

--
Chris Christoph P. U. Kukulies kuku AT gil DOT physik DOT rwth-aachen DOT de

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019