Mailinglist Archive: opensuse-programming (55 mails)

< Previous Next >
Re: [suse-programming-e] How can I debug a PERL program ?
  • From: Morten Gulbrandsen <Morten.Gulbrandsen@xxxxxxxxxxxxxx>
  • Date: Mon, 14 Mar 2005 08:02:18 +0100
  • Message-id: <423536FA.4080008@xxxxxxxxxxxxxx>
Derek Fountain wrote:
Normally no interpreted language needs a debugger.

Only compiled and linked does.

Interesting statement. Would you care to expand on why you think that?


I had a discussion with other programmers
what the difference between a compiled and an interpreted language was.

At that time I were coding in PERL, I read that it existed a version of PERL, which actually could compile and link PERL source code.

The other programmer said that the difference between an interpreter and a debugger lies solely in the language.

He had the honest opinion that an interpreted Language like PERL was impossible to compile. An it could never exist any interpreter for C.


This I did investigate and I actually managed to find an interpreter for C sourcecode. And a compiler for Perl.

which means,
-> PERL can be compiled
can be linked
can be executed

all under control of the programmer with the options and environment he wants.

I also took a closer look at the interpreted C language,
which was a subset of K&R C.

It was nearly like Maple,

I then investigated what exactly a debugger was.

best example: visual studio,

I got the conclusion that a debugger was a very complex environment,
that simulated the whole compile, link, load and execute process.

I also got the feeling, that any interpreter did the same.

I also took a look at what was required to make a good c compiler,

and found that making a debugger was a lot more that making a compiler.

Maybe I am wrong, but a debugger is a simulator.

Someone could make a PERL compiler,

When I use PERL, Python or PHP as interpreted languages,

all kinds of assertions stops whenever it is required,

gives the same information as any debugger. and In my eyes replaces a debugger.

The levels of warnings usually set in a compiler before initial compilation takes place.

is set at the beginning of a PERL script.

I have some old PERL books and could recall what thay wrote about building a PERL compiler, linker and loader,

IIRC, If I remember correctly.

It was simply a discussion between another programmer and me that triggered the definition of an interpreter and a compiler.

That showed me, a language like c could be interpreted,

A language like PERL, could be compiled.

The environment that parses, compiles and does what a debugger like visual studio did, is nearly the same as any PERL. PHP and Python interpreter does.

==> hence Debugger == Interpreter for me.

This is only my initial idea.

I'm only trying to help, I can be wrong,

I'm not Knuth, nor Dijkstra.

Please correct me, here is my proposition

Compiler + debugger => Interpreter.

Interpreter =>
simulation of compilation and debugging at the same time.
under control by the programmer.

I can be very wrong.

But I also believe this is true for any language.

if you like, I can fetch my PERL books and find out what Larry Wall has to tell, If I remember correctly.

fell free to tell me your opinion.

I have to append,
at that time PERL was not object oriented.

best regards

Morten Gulbrandsen

"If we all think exactly the same,
then it must be someone who is not thinking at all"

< Previous Next >