Re: Pascal program file parameter to Ada translation (Was: Re: Is GPC dead?)

Kevan Hashemi <[email protected]> Wed, 04 Jan 2017 15:15:04 -0500
Newsgroups gmane.comp.compilers.gpc
Organization Brandeis University
Message-ID <[email protected]>
Dear Leo

> I'm not sure how committed people on this list are to staying with 
> Pascal but if you are prepared to jump ship to Ada then I can tell
> you from my own experience it is well worth the effort.

This is an interesting proposal.

I just installed GCC 4.7.0 with ADA included on my MacOS 10.7 laptop 
(still with 10.7 so I can use existing GPC binaries). The ADA compiler 
works right away, which is awesome.

I downloaded p2ada binaries and translate the following program:

program p; begin writeln('hello world from Pascal.'); end.

The ADA output compiles immeditaely in the ADA compiler, and runs 
correctly. I note that the ADA code contains 38 lines, but I'm guessing 
that much of the extra occurs only once per translation. I now try to 
translate the following program:

program p;

type
   graph_type(num_points:integer)=array [0..num_points-1] of real;
   graph_ptr=^graph_type;

var
   xg:graph_ptr;
   i:integer;
	
begin
   new(xg,100);
   for i:=0 to 99 do xg^[i]:=i;
end.

In p2ada I get: "Syntax Error at line 4"

It looks like p2ada does not translate dynamic schema types. I would 
have to convert them all manualy. But does ADA itself support dynamic 
schema types? It supports a format like this:

type QData is array(Positive range <>) of Quarndex;

I guess that's an array of any integer size. If anyone can confirm that 
it's possible to translate dynamic schema types into ADA, then this 
translation looks like a good long-term solution.

Yours, Kevan

-- 
Kevan Hashemi, Electrical Engineer
Physics Department, Brandeis University
http://alignment.hep.brandeis.edu/

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc