Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-08

Pascal to Javascript - Still being Updated ? / General Conversion

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Daniel Gaspary

Hi,

In April 2014 Michael sent[1] a call for help about Pascal to JS conversion.

Is it still being maintained?

How about change to an Abstract Converter Class(interface?) ??

I am thinking about using the same structure to convert to some text format.

How could be the best way make the Convert Functions Return Type independent?

Current format:

   Function ConvertStatement(El: TPasImplStatement; AContext:
TConvertContext ): TJSElement;virtual;
   Thank you,
      Daniel
   [1] http://lists.freepascal.org/pipermail/fpc-devel/2014-April/033689.html

Reply by email

Michael Van Canneyt
to Daniel Gaspary
Daniel Gaspary wrote 5 lines
Hi, In April 2014 Michael sent[1] a call for help about Pascal to JS conversion. Is it still being maintained?

Yes. I plan to work on it at the end of the summer. I got some ideas for var parameters which will allow me to progress significantly.

How about change to an Abstract Converter Class(interface?) ??

What do you mean by this ?

I am thinking about using the same structure to convert to some text format.

All you will have in common is the fcl-passrc ?

How could be the best way make the Convert Functions Return Type independent?

That makes IMHO no sense, but maybe I do not understand what you mean ?

Michael.

Reply by email

Daniel Gaspary
to Michael Van Canneyt
Michael Van Canneyt wrote 8 lines
> How about change to an Abstract Converter Class(interface?) ?? What do you mean by this ? > I am thinking about using the same structure to convert to some text > format. All you will have in common is the fcl-passrc ?

Today the Converter is dedicated to one format only: Javascript.

I was thinking about a base Pascal converter. After that, specific converters could be implemented:

TPascalConverter = class

procedure WriteIfStatement(...); virtual;
procedure WriteWhileStatement(...); virtual;
end;

TPascalToJavascriptConverter = class(TPascalConverter)

procedure WriteIfStatement(...); override;
end;
TPascalToJSonConverter = class(TPascalConverter)
procedure WriteIfStatement(...); override;
end;

Something like that.

Reply by email

Michael Van Canneyt
to Daniel Gaspary
Daniel Gaspary wrote 33 lines
On Sun, Aug 2, 2015 at 4:18 AM, Michael Van Canneyt wrote: >> How about change to an Abstract Converter Class(interface?) ?? > > What do you mean by this ? > >> I am thinking about using the same structure to convert to some text >> format. > > All you will have in common is the fcl-passrc ? Today the Converter is dedicated to one format only: Javascript. I was thinking about a base Pascal converter. After that, specific converters could be implemented: TPascalConverter = class procedure WriteIfStatement(...); virtual; procedure WriteWhileStatement(...); virtual; end; TPascalToJavascriptConverter = class(TPascalConverter) procedure WriteIfStatement(...); override; end; TPascalToJSonConverter = class(TPascalConverter) procedure WriteIfStatement(...); override; end; Something like that.

Like I said, all that is in common then is fcl-passrc. This proposed class will just contain some loops, I'm not sure if that is worth it ?

But if you want to do the ground work (create a superclass for the current converter): Be my guest. Make sure the testsuite of the JS converter runs without errors.

Michael.

Reply by email

Daniel Gaspary
to Michael Van Canneyt
Michael Van Canneyt wrote
Like I said, all that is in common then is fcl-passrc. This proposed class will just contain some loops, I'm not sure if that is worth it ?

Yes, it would be a kind of Pascal Reader, just walking the source tree.

The conversion itself could be another class.

But if you want to do the ground work (create a superclass for the current converter): Be my guest. Make sure the testsuite of the JS converter runs without errors.

I will think about it.

Thank you, Michael.

Reply by email