You are here: Foswiki>PM Web>MiniNews>PugsFirstBlood (25 Aug 2007, SteffenSchwigon?)EditAttach
[See PugsFirstBloodEnglish for an english translation.]

Meine erste Perl6/Pugs-Installation

Wer mit Perl6 experimentieren möchte, nimmt in diesen Tagen Pugs. Das zu kompilieren ist gar nicht so schwer. Ich hab's auf einem Debian Sarge getan. Hier die einzelnen Schritte.

Parrot

Parrot ist die virtuelle Maschine für Perl6.

Svn checkout, compile, install

Erster Versuch

Beispielprogramm (Fibonacci-Zahlen) aus der Parrot-Doku:

  • fib.pasm

### Local Variables:
### mode: pasm
### End:
# Fibonacci-Zahlen
        print   "The first 20 fibonacci numbers are:\n"
        set     I1, 0
        set     I2, 20
        set     I3, 0
        set     I4, 1
REDO:   set     I5, I4
        add     I4, I3, I4
        set     I3, I5
        print   I3
        print   "\n"
        inc     I1
        lt      I1, I2, REDO
DONE:   end

(Ein Emacs-Mode u.a. für Syntaxhighlighting von .pasm-Files ist bei Parrot dabei, im Verzeichnis editors.)

  • Ausführen, Variante 1, direkt:
    • parrot fib.pasm
  • Ausführen, Variante 2, via Bytecode:
    • parrot -o fib.pbc fib.pasm
    • parrot fib.pbc

Ok, geht.

Falls /usr/local/bin/parrot nicht startet (bei mir z.B. mit v0.4.3), hilft evtl. ein cp parrot /usr/local/bin/

Haskell

Pugs ist in Haskell implementiert. Wir brauchen mindestens die Haskell-Version 6.6.1.

Vorarbeiten

Haskell benötigt Haskell zum Bootstrappen. Also zuerst eine ältere Version besorgen, gibt's bei Debian:

  • apt-get install ghc6

Download, compile, install

  • wget http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-src.tar.bz2
  • wget http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-src-extralibs.tar.bz2
  • tar xjf ghc-6.6.1-src.tar.bz2
  • tar xjf ghc-6.6.1-src-extralibs.tar.bz2
  • cd ghc-6.6.1
  • ./configure
  • make
  • make install                   # (als root)

Das Compilieren dauert wirklich lange. Mein 2 GHz Celeron hat bestimmt 5 Stunden für "make" gebraucht.

Wie man Haskell ausprobiert, weiß ich nicht, aber Pugs wird schon rummeckern, falls was nicht geht. Also ab zum nächsten Kapitel.

PUGS

Pugs ist eine Implementation der Perl6-Spezifikation in Haskell, das Perl User's Golfing System.

Svn checkout, compile, install

  • svn co http://svn.pugscode.org/pugs pugs
  • cd pugs
    • Nur für Liebhaber, jetzt erweiterte Optionen einschieben:
      • apt-get install zlib1g-dev
      • apt-get install libperl-dev (bin nicht ganz sicher)
      • CPAN: install Bundle::Pugs::SmokeKit
      • CPAN: install Scriptalicious
      • CPAN: install Class::Multimethods::Pure
      • CPAN: install Data::Bind
      • CPAN: install version
      • export PUGS_EMBED="parrot"
      • export PARROT_PATH=${HOME}/path/to/src/parrot/
      • make clean (scheint doch öfter notwendig zu sein)
  • perl Makefile.PL
  • make
  • make test
    • paar Fehler waren dabei, hab' ich ignoriert
  • make install            # als root

Erster Versuch

  • pugs -e 'say "Hello, world.";'

Fertig.

-- SteffenSchwigon? - 06 Aug 2005

Topic revision: r13 - 25 Aug 2007 - 21:55:12 - SteffenSchwigon?
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback