Skip to content
This repository

Perl 5 and Perl 6 compilers

tree: 7f0ac392df
README
MiniPerl6 "Perlito" compiler

- main Perlito repository: http://github.com/fglock/Perlito

- main Project web page: http://www.perlito.org

Go backend

    perl mp6.pl -Bgo t/04-op.t

    Creating a bootstrapped compiler:

    # create a "6.out" binary, using mp6.pl
    perl mp6.pl -Bgo util/mp6.pl    
    # test the binary
    ./6.out -Cgo t/04-op.t          
    # recompile the compiler using itself
    ./6.out -Cgo util/mp6.pl > mp6-go.go   
    6g mp6-go.go
    6l mp6-go.6
    ./6.out -Cgo util/mp6.pl > mp6-go-new.go
    # "mp6-go.go" and "mp6-go-new.go" should be identical

    See also: Go homepage at http://golang.org

Java class backend

    perl mp6.pl -Bjava-class -e 'class Main { say "hello, World!" }'
    java tmp

    Creating a bootstrapped compiler:

    # create a Java class, using mp6.pl:
    perl mp6.pl -v -Bjava-class util/mp6.pl
    # test "tmp.class"
    java tmp -Cjs t/04-op.t

    Requires Rhino's js.jar in CLASSPATH, see also: http://www.mozilla.org/rhino

Javascript backend - browser

    Open the file 'perlito.html' in a browser (Firefox, Chrome, or Safari).

    Alternately, browse to:

    http://perlcabal.org/~fglock/perlito.html

Javascript backend - command line

    Executing from the command line requires Perl 5 and a javascript compiler (V8 or Rhino):

    perl mp6.pl -Bv8 -e 'class Main { say "hello, World!" }'

    perl mp6.pl -Brhino -e 'class Main { say "hello, World!" }'

    Creating a bootstrapped compiler:

    # compile util/mp6.pl to Javascript, using mp6.pl:
    perl mp6.pl -Bperl5 util/mp6.pl -Cjs util/mp6.pl > util-js/mp6.js
    # testing the bootstrap with Rhino
    java org.mozilla.javascript.tools.shell.Main util-js/mp6.js -Cjs util/mp6.pl > mp6-new.js

    See also: 

        V8 homepage at http://code.google.com/apis/v8

        Rhino homepage at http://www.mozilla.org/rhino

Lisp backend

    perl mp6.pl -Blisp -e 'class Main { say "hello, World!" }'
    # lots of warnings from SBCL!

    Creating an executable image:

    . util-lisp/create-core-image.sh
    ./mp6-lisp t/04-op.t

    Creating a bootstrapped compiler:

    # compile util/mp6.pl to Lisp, using mp6.pl:
    perl mp6.pl -Bperl5 util/mp6.pl -Clisp util/mp6.pl > util-lisp/mp6.lisp
    # testing the bootstrap with SBCL
    sbcl --script util-lisp/mp6.lisp -Clisp util/mp6.pl > mp6-new.lisp

    See more utilities in util-lisp directory.

    See also: SBCL homepage at http://www.sbcl.org

Parrot backend

    The parrot backend is not bootstrapped, and it doesn't pass all tests.

    The perl 5 backend can be used to compile MiniPerl6 to parrot:

    perl mp6.pl -Bparrot -e 'class Main { say "hello, World!" }'

    See also: Parrot homepage at http://www.parrot.org

Perl 5 backend

    perl mp6.pl -e 'class Main { say "hello, World!" }'

    See also: Perl 5 homepage at http://www.perl.org

    Creating a bootstrapped compiler:

    # compile util/mp6.pl using mp6.pl:
    perl mp6.pl -Cperl5 util/mp6.pl > mp6-perl5.pl 
    # testing the bootstrap 
    perl -Ilib5 mp6-perl5.pl -Cperl5 util/mp6.pl > mp6-new.pl

AST output

    perl mp6.pl -Cast-json -e 'class Main { say "hello, World!" }'

RUNNING TESTS

Testing a backend using the Perl5 based compiler

    prove -e "perl mp6.pl -Bjs"
    prove -e "perl mp6.pl -Bperl5"
    prove -e "perl mp6.pl -Blisp"
    prove -e "perl mp6.pl -Bgo"

Testing the Lisp binary image compiler

    prove -e "./mp6-lisp"

Testing Rakudo Perl6 compatibility

    prove -e "perl6"

AUTHORS

Flavio Soibelmann Glock - fglock@gmail.com
The Pugs Team - perl6-compiler@perl.org

SEE ALSO

The Perl 6 homepage at http://dev.perl.org/perl6
The Pugs homepage at http://pugscode.org
The Perlito homepage at http://perlito.org

COPYRIGHT

Copyright 2006, 2009, 2010 by Flavio Soibelmann Glock, Audrey Tang and others.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html
Something went wrong with that request. Please try again.