comp.lang.ada
 help / color / mirror / Atom feed
* Compilers
@ 1994-11-11 21:31 Dave Jackson
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Jackson @ 1994-11-11 21:31 UTC (permalink / raw)


Can anyone on this newsgroup suggest a decent but modern Ada compiler...preferably Shareware if there
is such a thing. I urgently need one for the PC to help with my studies in the U.K. I would be greatful for any help.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Compilers
@ 1999-08-05  0:00 Shawn Barber
  1999-08-06  0:00 ` Compilers Samuel T. Harris
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn Barber @ 1999-08-05  0:00 UTC (permalink / raw)


   I have been given the task of adding math functionality
to a proprietary language we have developed. The compiler we
wrote uses Aflex and Ayacc to create the parser and lexer. I
have our compiler processing the math expression, it's just
not evaluating them. So now to my question, has anyone
accomplished this, either with Ayacc/Aflex or with a
different Parser and Lexer generator? Thanks in advance for
at least reading this.

Shawn



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Compilers
  1999-08-05  0:00 Compilers Shawn Barber
@ 1999-08-06  0:00 ` Samuel T. Harris
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel T. Harris @ 1999-08-06  0:00 UTC (permalink / raw)


Shawn Barber wrote:
> 
>    I have been given the task of adding math functionality
> to a proprietary language we have developed. The compiler we
> wrote uses Aflex and Ayacc to create the parser and lexer. I
> have our compiler processing the math expression, it's just
> not evaluating them. So now to my question, has anyone
> accomplished this, either with Ayacc/Aflex or with a
> different Parser and Lexer generator? Thanks in advance for
> at least reading this.
> 
> Shawn
> 
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!

I have done this many time with ayacc and aflex.
These tools are great for producing recognizers for any but
the simplest formats. I've used them to read in complex data
file formats, a FORTRAN to Ada translator, and various
command parsers and script languages.

To evaluate the expression, your yytype needs to include
a numeric field to hold the value at that node.
Each production involving an operator then must set
the $$ node to the result of the operation on the operands.
Something like ...

item : term d_add term
{ $$.expression := $1 + $2; }
;

... where d_add is a delimiter for '+' returned by the lexer
and expression is the field of yytype which hold expression values.
This assumes you want the operations performed as they
are recognized and are not building a parse tree for later
execution.

If you follow the example of expression syntax used in Ada,
the precedence of operations is naturally represented in the
syntax and no special effort if required to insure that in
1 + 2 * 3, 2 is multiplied with 3 and then 1 is added to the result.

-- 
Samuel T. Harris, Principal Engineer
Raytheon, Scientific and Technical Systems
"If you can make it, We can fake it!"




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-08-06  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-11-11 21:31 Compilers Dave Jackson
  -- strict thread matches above, loose matches on Subject: below --
1999-08-05  0:00 Compilers Shawn Barber
1999-08-06  0:00 ` Compilers Samuel T. Harris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox