[OT] Perl to C Converter?

A

Alan Connor

There's this utility called html2ps that's written in perl, but
the box I want to run it on doesn't have room for perl. It does
have room for a C compiler.

Be nice if I could find a tool that converted perl to C.

Thanks in advance for any help.

(running debian linux here)

AC
 
A

Alan Connor


There are utilities for converting one programming language to another.

Lots of them. For major and minor languages.

(The very program I am referring to above, html2ps, is
such a program. HTML is a language understood by webbrowsers, and PS is
a language understood by printers.)

Why not this one?

Why couldn't that programmer that knows both languages sit down and
write a perl2C converter in C?

The answer is, of course, that they could.

Have they?

That's what I am trying to find out.

AC
 
J

Joe Smith

Alan said:
There's this utility called html2ps that's written in perl, but
the box I want to run it on doesn't have room for perl. It does
have room for a C compiler.

A general purpose perl-to-C converter will be the same size as perl itself.
If the program you're coverting uses eval($string), then you'd have to
include the *entire* perl language.
-Joe
 
J

Joe Smith

Alan said:
There are utilities for converting one programming language to another.
Why not this one?
Why couldn't that programmer that knows both languages sit down and
write a perl2C converter in C?

Too much effort, insufficient payoff.
Look at "perldoc -q compile" to see how others have done similar.
-Joe
 
A

Alan Connor

A general purpose perl-to-C converter will be the same size as perl itself.
If the program you're coverting uses eval($string), then you'd have to
include the *entire* perl language.
-Joe

Sure, but the perl-to-C converter would not have to be on the box that
I want to run html2ps on. I can do the conversion and compilation elsewhere
and then have a nice little C binary to install on that box, which will be
a small fraction of the size of perl and the perl html2ps.

AC
 
R

Richard Pennington

Alan said:
Sure, but the perl-to-C converter would not have to be on the box that
I want to run html2ps on. I can do the conversion and compilation elsewhere
and then have a nice little C binary to install on that box, which will be
a small fraction of the size of perl and the perl html2ps.

AC

When the little C binary encounters eval($string) it could email
the big box and ask it to convert $string to C, compile it, and
email the binary back. Watch out for virus protection filters! ;-)

-Rich
 
A

Alan Connor

Too much effort, insufficient payoff.

Huh? Most of the perl groups are dead. Millions of gigabytes of hdd
space could be saved, as well as all the other system resources that
perl requires.

Such a program would be used extensively.

And perl would lose a lot of users. Someone would set up an ftp site
with C versions of most of the perl programs and who wouldn't choose
them over perl if they weren't interested in learning to program in perl?
Look at "perldoc -q compile" to see how others have done similar.
-Joe

Okay. Thanks.

But why would they have "done similar" if such an effort has "insufficient
payoff"?

AC
 
A

Alan Connor

When the little C binary encounters eval($string) it could email
the big box and ask it to convert $string to C, compile it, and
email the binary back. Watch out for virus protection filters! ;-)

ROTFL !!


AC
 
K

Keith Thompson

[...]
[...]
There are utilities for converting one programming language to another.

Lots of them. For major and minor languages.

(The very program I am referring to above, html2ps, is
such a program. HTML is a language understood by webbrowsers, and PS is
a language understood by printers.)

Why not this one?

Why couldn't that programmer that knows both languages sit down and
write a perl2C converter in C?

The answer is, of course, that they could.

Have they?

That's what I am trying to find out.

Such a tool does in fact exist.

See my article <[email protected]>, posted 2003-11-05, subject
'Re: "Mastering C Pointers"....', for an explanation of the reason I'm
choosing not to share more information with you. My final statement
in that article still stands, but I make no promises.

<http://groups.google.com/[email protected]>

Just a reminder that behavior has consequences.
 
T

tigervamp

If you just want to get an html to postscript converter on your
machine, you can download one of many such C programs. <OT> It is
also possible to convert a perl program into a native executable using
freely available experimental software or the Perl2Exe software
provided by indigoSTAR (www.indigostar.com). You could then run this
converted Perl program on a machibe that does not have Perl said:
There are utilities for converting one programming language to another.

Lots of them. For major and minor languages.

Not sure what you mean by major and minor languages.
(The very program I am referring to above, html2ps, is
such a program. HTML is a language understood by webbrowsers, and PS is
a language understood by printers.)
Why not this one?

<OT> I think there is a big difference here. First, html and ps are
not programming languages, they are markup languages used to describe
how something should be presented. Additionally, most of the time,
html and ps documents are not read or written by hand, they are
created and presented with tools that understand the language which is
why I think that tools that can convert between them are more useful
(since there probably aren't many people that can convert to or from
postscript by hand). A tool to convert between programming languages,
especially between something like C and Perl, would be much more
difficult to implement and would probably require some knowledge of
both languages just to use in most cases anyway. I also don't think
the demand is there. said:
Why couldn't that programmer that knows both languages sit down and
write a perl2C converter in C?

The answer is, of course, that they could.

Have they?

<OT> Not that I am aware of, and as I said above, it probably wouldn't
be an seamless solution. It would also probably involve having Perl
installed on the machine doing the conversion. I also don't think
that many people who know both languages are very interested in
creating such a tool (and apparently they aren't). Perl is more of a
high-level scripting language and most people that use it don't really
have an interest in having their programs converted to C. Alot of
people using Perl have migrated from C or have a dislike for C as well
That's what I am trying to find out.

AC

Rob Gamble
 
A

Alan Connor

[...]
[...]
There are utilities for converting one programming language to another.

Lots of them. For major and minor languages.

(The very program I am referring to above, html2ps, is
such a program. HTML is a language understood by webbrowsers, and PS is
a language understood by printers.)

Why not this one?

Why couldn't that programmer that knows both languages sit down and
write a perl2C converter in C?

The answer is, of course, that they could.

Have they?

That's what I am trying to find out.

Such a tool does in fact exist.

See my article <[email protected]>, posted 2003-11-05, subject
'Re: "Mastering C Pointers"....', for an explanation of the reason I'm
choosing not to share more information with you. My final statement
in that article still stands, but I make no promises.

<http://groups.google.com/[email protected]>

Just a reminder that behavior has consequences.

Here's the article:

<quote>

From: Keith Thompson ([email protected])
Subject: Re: "Mastering C Pointers"....
View: Complete Thread (355 articles)
Original Format
Newsgroups: comp.lang.c
Date: 2003-11-04 16:06:20 PST

Alan Connor said:
I think for myself, Keith.

And I think you are a liar, and am sick of this continued smear campaign
against Roose.

Mr. Connor, you are a fool. I freely admit that any statement I make
might be mistaken, but I have not deliberately lied in this thread or
any other, and I deeply resent the accusation. I was honestly trying
to offer you the benefit of my experience, and this is how you respond.

If I used a killfile, you would now be in it. If I see you posting
misinformation, I may or may not post a correction for the benefit of
others. I will not make any further attempts to help you; others will
do as they wish.

(If you wish to apologize, I will consider disregarding your
accusation and moving on.)

--
Keith Thompson (The_Other_Keith) (e-mail address removed) <http://www.ghoti.net/~kst>
<snip>


</quote>


You were visciously and unfairly attacking that fellow.

If you do it again, you will get the same sort of post from me.

Don't like it? Then eat shit.

Or change your behavior, you arrogant fucking punk.

---------


Thanks for letting me know that the program exists.

Finding it is now just a matter of legwork.

If you are lying about this, the whole Usenet will learn of it,
and you will be killfiled in droves.

People will know that you not only cannot be trusted, but maliciously
mislead people.

Actions do indeed have consequences.



AC
 
A

Alan Connor

If you just want to get an html to postscript converter on your
machine, you can download one of many such C programs.

That's very good news.
<OT> It is
also possible to convert a perl program into a native executable using
freely available experimental software or the Perl2Exe software
provided by indigoSTAR (www.indigostar.com). You could then run this
converted Perl program on a machibe that does not have Perl </OT>

That must be what Joe Smith was talking about.
Not sure what you mean by major and minor languages.


<OT> I think there is a big difference here. First, html and ps are
not programming languages, they are markup languages used to describe
how something should be presented.

They are still programming languages of a sort. And PS is considerably
more complex than HTML, because it contains all sorts of instructions
to the printer.

Additionally, most of the time,
html and ps documents are not read or written by hand, they are
created and presented with tools that understand the language which is
why I think that tools that can convert between them are more useful
(since there probably aren't many people that can convert to or from
postscript by hand). A tool to convert between programming languages,
especially between something like C and Perl, would be much more
difficult to implement and would probably require some knowledge of
both languages just to use in most cases anyway. I also don't think
the demand is there. </OT>

What a printer can deal with is much simpler HTML than a browser can
deal with, obviously.

This is simple to write by hand. I do it all the time.

It seems to me that the first step in such a program would be to convert
the HTML source to HTML 2.0, (or thereabouts) and then to convert it to PS.

By-the-way: Keith Thompson <[email protected]> says that a perl2C program exists....

(and is arrogant enough to think I will take his word for it even though
it came packaged in another of the attacks the creep loves to launch.
<OT> Not that I am aware of, and as I said above, it probably wouldn't
be an seamless solution. It would also probably involve having Perl
installed on the machine doing the conversion. I also don't think
that many people who know both languages are very interested in
creating such a tool (and apparently they aren't). Perl is more of a
high-level scripting language and most people that use it don't really
have an interest in having their programs converted to C. Alot of
people using Perl have migrated from C or have a dislike for C as well
</OT>

I use bash for a scripting language. Works fine.
Rob Gamble

Thanks Rob.


AC
 
A

Arthur J. O'Dwyer

Such a tool does in fact exist.

See my article <[email protected]>, posted 2003-11-05, subject
'Re: "Mastering C Pointers"....', for an explanation of the reason I'm
choosing not to share more information with you. My final statement
in that article still stands, but I make no promises.

<http://groups.google.com/[email protected]>

Just a reminder that behavior has consequences.

Expressions of respect and support to Keith for that! :) I hope
it won't be perceived as too much of an undermining for me to point
out that Alan's question is indeed a FAQ in the appropriate newsgroup,
and it's /really easy/ to find the answer using a search engine.
And that I think I know what tool you're thinking of, and the generated
code is absolutely impenetrable. ;)

-Arthur,
re-reading "The Diamond Age"
 
R

Robert Gamble

By-the-way: Keith Thompson <[email protected]> says that a perl2C program
exists....

There is something called perlcc, a google search will provide plenty of
insight. I don't know if it will help you though, I just "compiled" a
31kB perl script into C and the result was 8MB of unreadable code.
Compiling the code resulted in a 3.5MB executable that dies immediately. I
think this requires Perl installed and it appears to include the Perl
source into the program. This program appears to be fairly new and
probably has a long way to go before it is very useful.

Rob Gamble
 
A

Alan Connor

There is something called perlcc, a google search will provide plenty of
insight. I don't know if it will help you though, I just "compiled" a
31kB perl script into C and the result was 8MB of unreadable code.

Yow.

Not very well commented?

:))
Compiling the code resulted in a 3.5MB executable that dies immediately. I
think this requires Perl installed and it appears to include the Perl
source into the program. This program appears to be fairly new and
probably has a long way to go before it is very useful.

Rob Gamble

But this information is very useful.

Thank you, Rob. It may well be that an html2ps app in C is the answer
here and I have seen evidence that they exist.

There's one called a2ps, but it isn't being maintained and requires
netscape.

AC
 
C

CBFalconer

Alan said:
Sure, but the perl-to-C converter would not have to be on the box
that I want to run html2ps on. I can do the conversion and
compilation elsewhere and then have a nice little C binary to
install on that box, which will be a small fraction of the size
of perl and the perl html2ps.

So sit down with a listing of html2ps.prl as a guide, and write
your own C version. That limits your understanding of perl to the
portions used. The critical thing is how to massage the data.
 
A

Alan Connor



Package: htmldoc
Priority: extra
Section: web
Installed-Size: 1508
Maintainer: Jeff Licquia <[email protected]>
Architecture: i386
Version: 1.8.14-1
Depends: libc6 (>= 2.2.3-7), libfltk1, libjpeg62, libpng2 (>= 1.0.12), xlibs (>>
4.1.0), zlib1g (>= 1:1.1.3)
Filename: pool/main/h/htmldoc/htmldoc_1.8.14-1_i386.deb
Size: 854002
MD5sum: 6d393d0d1dbe2a9041b7df243d8ef2ed
Description: HTML processor that generates indexed HTML, PS, and PDF.
HTMLDOC is a program for writing documentation in HTML and producing
indexed HTML, PostScript, or PDF output (with tables of contents).
It supports most HTML 3.2 and some HTML 4.0 syntax, as well as GIF,
JPEG, and PNG images.


That sure does look promising, Rob. Thanks.

I thought I had searched /var/lib/dpkg/available thoroughly, but there
it was...

<slaps head>

<ouch>

:)

Will let you know how it works on my simple HTML.

Let's see: Su to root and run apt-get install htmldoc.

I can handle that.

AC
 
A

Alan Connor

Sure, but the perl-to-C converter would not have to be on the box that
I want to run html2ps on. I can do the conversion and compilation elsewhere
and then have a nice little C binary to install on that box, which will be
a small fraction of the size of perl and the perl html2ps.

AC

I remember you, Mr. Falconer.

Pardon me while I ignore your posts.


AC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top