This project presents a Perl compiler that compiles Perl into Java bytecode and runs it, providing a method to integrate Perl with Java-based ecosystems.
This project aims to develop a Perl compiler that translates Perl code into Java bytecode and executes it on the Java Virtual Machine (JVM). It provides a platform for running Perl scripts in a JVM environment, facilitating integration between Perl and Java.
ScriptEngine
interface.For a detailed feature list, see the FEATURE_MATRIX.md.
Ensure you have Maven installed:
Compile and Package the Project:
mvn clean package
Run the JAR:
java -jar target/perlonjava-1.0-SNAPSHOT.jar
Ensure you have Gradle installed:
Compile and Package the Project:
gradle clean build
Run the JAR:
java -jar target/perlonjava-1.0-SNAPSHOT.jar
maven-shade-plugin
for Maven to create a shaded JAR.com.github.johnrengelman.shadow
plugin for Gradle to create a shaded JAR.Show Instructions:
java -jar target/perlonjava-1.0-SNAPSHOT.jar --help
Execute Something:
java -jar target/perlonjava-1.0-SNAPSHOT.jar -e ' print 123 '
Setting lib
path with -I
to access Perl modules is optional. Standard modules are included in the jar file.
Execute Emitting Debug Information:
java -jar target/perlonjava-1.0-SNAPSHOT.jar --debug -e ' print 123 '
Compile Only; Can Be Combined with --debug:
java -jar target/perlonjava-1.0-SNAPSHOT.jar -c -e ' print 123 '
java -jar target/perlonjava-1.0-SNAPSHOT.jar --debug -c -e ' print 123 '
Execute and Emit Disassembled ASM Code:
java -jar target/perlonjava-1.0-SNAPSHOT.jar --disassemble -e ' print 123 '
Run the Lexer Only:
java -jar target/perlonjava-1.0-SNAPSHOT.jar --tokenize -e ' print 123 '
Run the Parser Only:
java -jar target/perlonjava-1.0-SNAPSHOT.jar --parse -e ' print 123 '
/
├── src/
│ ├── main/
│ │ └── perl/
│ │ │ └── lib/
│ │ │ └── Perl modules (strict.pm, etc)
│ │ └── java/
│ │ └── org/
│ │ └── perlonjava/
│ │ ├── Main.java
│ │ ├── ArgumentParser.java
│ │ ├── scriptengine/
│ │ │ ├── PerlScriptEngine.java
│ │ │ └── other script engine classes
│ │ ├── astnode/
│ │ │ ├── Node.java
│ │ │ └── other AST node classes
│ │ ├── lexer/
│ │ │ ├── Lexer.java
│ │ │ └── other lexer classes
│ │ ├── parser/
│ │ │ ├── Parser.java
│ │ │ └── other parser classes
│ │ ├── perlmodule/
│ │ │ ├── Universal.java
│ │ │ └── other internalized Perl module classes
│ │ ├── operators/
│ │ | ├── OperatorHandler.java
│ │ | ├── ArithmeticOperators.java
│ │ | └── other operator handling classes
│ │ └── runtime/
│ │ ├── RuntimeScalar.java
│ │ └── other runtime classes
│ └── test/
│ ├── java/
│ │ └── org/
│ │ └── perlonjava/
│ │ └── PerlLanguageProviderTest.java
│ └── resources/
│ └── Perl test files
├── build.gradle
├── pom.xml
├── settings.gradle
├── examples/
│ └── Perl example files
└── misc/
└── project notes
UNIVERSAL
and Symbol
.PerlScriptEngine
is a Java class that allows you to execute Perl scripts using the Java Scripting API (JSR 223).For detailed information on completed and upcoming milestones, see the MILESTONES.md.
This project is licensed under the Perl Artistic License 2.0 - see the LICENSE file for details.
For more details on the relationship with the Perlito compiler, see RELATION_WITH_PERLITO_COMPILER.md.