ANN: bridgekeeper 0.0.1 - a Perl to Python source code converter

Hartmut Goebel
Mon, 01 Apr 2002 01:19:38 +0200

goebel consult proudly announces


		A Perl to Python source code converter

(N=FCrnberg/2002-04-01) While 2001 brought us Parott, pyperl and
pyperlish, 2002 brings to you 'bridgekeeper', a Perl to Python source
code converter.

What 'bridgekeeper' does

'bridgekeeper' help converting Perl code to Python source. The
quallity of the output Python source depents on the quallity of the
input code.

If there are constructs within the Perl code which are not possible in
Python, you will get warnings. Eg. when using a name for both a hash
and a scalar within the same scope (%foo, $foo).

Converting Perl to Python will be a iterative process, see the
TUTORIAL for more information about this.

'bridgekeeper' consists of=20

* a Perl compiler back-end emitting Python-like source and=20

* a runtime Python package which tries to emulate some perl build-in

The name was inspired be the bridgekeeper-scene in Monty Pythons
'Search for the Holy Grail'.


* Already converts a lot of Perl code-constructs into Python source:
  loops, special variables, function calls, lists, hashes, methods,

* Whenever there is no equivalent Python function for a Perl function,
  the function is emulated using the included Python library.

* Includes a TUTORIAL 'How to convert Perl Code to Python Source'

* Warns about variables with same name but different type within a
  scope, eg. when using a name for both a hash and a scalar (%foo,
  $foo). This included scalars, hashes, lists, arrays and (hopefully)

* Warns about mixing variables with same name but different Perl
  scoping within a Python scope, eg. using (global) $foo and my $foo
  in one scope.

* Strips statements like 'my ($foo, %bar);'; this is: my and local
  declarations without assignment.

* Special variables are renamed to their equivalent within the
  included Python library.

* 'here-documnets' are supported.


* Does not support 'use', 'BEGIN', 'END', etc. This is due how Perl
  handles these expressions: they get executed while parsing. See the
  Tutorial for solving this problem.

* Does not handle 'bless', 'packages', etc.

* References may or may not be resolved correctly.=20

* Does not convert things like 'my ($self, arg1, arg2) =3D @_;' into
  a pythonic argument-lists. (Hey, this would be a great feature!)

* In some rare cases Perl functions are converted to the
  nearly-equivalent Python function instead of using a emulated
  function. This is done for functions which return a value which is
  probly not often used.

* The Python libary included contains all required functions, while
  many of them are not yet implemented.

* Formats are not supported anyhow. (But I already have an idea how
  this could be done: use a class perl.Format thatfore.) This also
  includes the function 'write'.

* Separate prototype declarations are not supported, whereas
  prototypes at function definitions are taken over (as comments).

* Prefix/postfix operator are not resolved.

* Esoteric execution orders are not supported (see

* The Python libary included is not thread-save -- and probably will
  never become thread-save.

* A lot more :-)


'bridgekeeper' is available for download at