Slashdot Mirror


Developer Creates An Experimental Perl 5 To Java Compiler (perl.org)

An anonymous reader writes: Saturday night saw the announcement of an experimental Perl 5 to Java compiler. "This is the first release," posted developer FlÃvio S. Glock -- after 100 weeks of development. "Note that you don't need to compile a Java file. Perlito5 now compiles the Perl code to JVM bytecode in memory and executes it." He describes the compiler as "a work-in-progress" that "provides an impressive coverage of Perl features, but it will not run most existing Perl programs due to platform differences."

42 of 94 comments (clear)

  1. Are they trying to parrot java with perl? by youn · · Score: 1

    no pun intended :p

    --
    Never antropomorphize computers, they do not like that :p
  2. Perl to Java Bytecode? by KermodeBear · · Score: 5, Funny

    Well, that's one way to make Perl even more unreadable. :P

    --
    Love sees no species.
  3. Re:Haven't they buried this yet? by ShanghaiBill · · Score: 5, Informative

    Perl 5 must be godawful if you need to compile it to Java.

    It isn't compiled to Java. It is compiled to JVM bytecode. Perl compilers have been done before, so the only new thing here is the backend target ... and that he claims to support "eval" without an embedded interpreter. I don't see how that is possible, and he should get a Turing award if he actually accomplished that.

  4. Dev deserves nerdly kudos - however by 93+Escort+Wagon · · Score: 5, Interesting

    I'm not sure if there's a practical point to this. Perl is going to be at least as widely supported as Java, so it's not a question of availability. And the dev makes no claims regarding speed... actually the dev makes no claims whatsoever, other than "here it is" and "most perl scripts won't work". If speed were actually the goal, I don't think Java byte code would be the target.

    From the standpoint of being a cool nerd project, though - most definitely. This does seem like a throwback to the "news for nerds" catch phrase.

    --
    #DeleteChrome
    1. Re:Dev deserves nerdly kudos - however by angel'o'sphere · · Score: 3, Insightful

      Java Byte Code is JIT compiled.
      So chances are that it is much faster than the original perl byte code.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    2. Re:Dev deserves nerdly kudos - however by Xest · · Score: 1

      I can speak for this type of application, I genuinely find these kind of projects useful, not for Java, but certainly for .NET.

      One of our products supports client scripting, and it used to just call out to native Lua, it was horrible doing this for many reasons, from performance due to unmanaged managed martialling, through to security issues in being difficult to sandbox.

      I replaced the scripting engine with one built ground up to resolve many of these issues, not least to make the damn thing more modular and testable. As a result of that I actually made the language part pluggable, so that we are now able to support multiple languages by just creating a simple language interface plugin, and whilst we do support native interpreters through this engine, we've now retired them all so that we only actually deliver managed languages running on the CLR now. The net result is that we're not simply bound to Lua, but we now support Lua, Python, C#, and a few others.

      The great thing is that performance is up, because we're not hit by the cost of manage/unmanaged martialling, and for languages that support it we allow for precomilation, so for example, precompiled C# scripts run between 40x - 80x faster than calling out to native Lua. But perhaps one of the biggest benefit, is that since we've retired support for native interpreters, and switched to only managed interpreters, we can now support sandboxing in an entirely consistent manner across all languages - that is, restrict what scripts can actually access and do. Our clients love the fact that they're not bound purely to Lua and can use things like Python now, and we're happier because the solution is more performant, and far more secure.

      So I get what you're saying, it's not obvious why all these language projects we see day in, day out are useful, but there are genuine uses - interop, scripting support and so forth can often take great advantage of these things. Creating managed implementations of languages on the JVM, on the CLR and so forth are great endeavors, and for anyone wishing to learn more about language implementation and so forth I would argue are far more productive avenues for self-learning for wider society, than creating yet another programming language that runs in it's own custom execution environment and that doesn't offer anything existing more widely supported languages already do better. I think it's worth making a distinction between projects like this - that expand the use cases for existing languages and technologies and so have wider benefits, and projects we often see pimped here where companies and individuals create a new language that they pretend is the next great thing, but basically never actually is. If nothing else, this project has real actual commercial use cases.

  5. oh goodie by ooloorie · · Score: 5, Funny

    The unpalatable compiling to the unspeakable.

    1. Re:oh goodie by thegarbz · · Score: 4, Funny

      And in most cases resulting in the unworkable.

  6. I heard his next project is: by JustNiz · · Score: 2

    Compiler for Bash Scripts to Visual Basic.

    1. Re:I heard his next project is: by glitch! · · Score: 2

      JCL to Javascript! "Run your IBM 360 card decks in your browser!"

      --
      A dingo ate my sig...
    2. Re:I heard his next project is: by JustNiz · · Score: 3, Insightful

      I bet there's a dusty old financial institution out there somewhere that would actually love that.

    3. Re:I heard his next project is: by Hognoxious · · Score: 2

      You can get mainframe emulators (the best known is called Hercules) that will run JCL, if you're bonkers enough to want to.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  7. Let's all bash Java! by Anonymous Coward · · Score: 1, Insightful

    Because it's the most used language! And does everything perfectly fine! And has tons of SDK support!

  8. Re:Sadist by king+neckbeard · · Score: 2

    Because you need 'enterprise' and 'synergy' to win at Corporate Buzzword Bingo.

    --
    This is my signature. There are many like it, but this one is mine.
  9. Re: /. java bashing by Anonymous Coward · · Score: 1

    It's honestly pretty pathetic. There are things to like in all the top languages. Java 8 with Spring/Hibernate is easy enough to use.

    But naturally, people hate what isn't super niche.

  10. Re:Anal Masturbation: How To Make Intensely Pleasu by dougTheRug · · Score: 1

    potentially causing irreparable farm??? Editors, please!!

  11. It's been done before by alangmead · · Score: 4, Informative

    Larry Wall made Java Perl Lingo (JPL, named after Larry's previous employer) around the release of Perl 5. O'Reilly first tried to sell it as a commercial software in the Perl Resource Kit, but eventually made it open source http://www.oreilly.com/pub/pr/... in a "dumpware" sort of mode. It eventually became incompatible with newer Perl and Java releases and I want to say it was abandoned, but that is pretending people used it.

  12. Re:/. java bashing by ooloorie · · Score: 1

    Don't bet on it. It's usually familiarity that breeds the greatest contempt.

  13. Re:Why? by skids · · Score: 3, Interesting

    Probably merging projects in different laguages on the JVM. Also if you are sandboxed to just the JVM, running Perl5 without hitting metal is neat. I dunno for sure, but this could conceivably play a part in helping Perl6's Inline::Perl5 perform on rakudo-jvm.

  14. 1996 Called... by Waffle+Iron · · Score: 1, Funny

    ... it wants its two hottest languages back.

  15. Re:Sadist by Anonymous Coward · · Score: 1

    You're mistaken. He didn't write a Python to Java compiler. Seriously: Python is a language for anal retentive assholes by anal retentive assholes. It doesn't trust its own users and it attempts to solve the "bad code" problem by throwing a shit ton of documentation acting as a Code Nazi. You can just hear the authors of this shit saying, "Auchtung! You vill code dis vay!" Meanwhile, it forgets that shitty developers don't read that kind of documentation, does nothing to stop them from continuing to write functions that go on for pages, and as a result solves nothing.

  16. Well, bash is better than csh by aberglas · · Score: 1

    more words more words more words

  17. MSDOS for Unix by aberglas · · Score: 1

    That is what the world really needs.

  18. Re: Haven't they buried this yet? by __aaclcg7560 · · Score: 2

    Considering how long Perl 5 existed before this happened, I'm fairly sure you don't need to do anything of the sort.

    I wasn't aware that Perl still existed until last year. I thought it disappeared in the aftermath of the dot com bust.

  19. Re:Haven't they buried this yet? by Anonymous Coward · · Score: 1

    you don't need an embeded interpreter.. you are already "interpreting it" to jvm

  20. Re: Haven't they buried this yet? by angel'o'sphere · · Score: 1

    /. is written in perl ...

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  21. Re: Haven't they buried this yet? by __aaclcg7560 · · Score: 1

    Why are you so proud of your own ignorance, creimer?

    Perl is a language that I heard about, never used and don't know anyone who had used it.

  22. Re: Haven't they buried this yet? by Anonymous Coward · · Score: 1

    I have programmed but I wouldn't call myself a programmer. I don't deserve to use the title. I haven't earned the right, no have I the experience, to use that title.

    So, pardon my ignorance, but could you explain why, in layman's terms, anyone would want to do this?

  23. Re: Haven't they buried this yet? by __aaclcg7560 · · Score: 2

    /. is written in perl ...

    That would explain why /. haven't been updated in 20 years.

  24. Re: Haven't they buried this yet? by Anonymous Coward · · Score: 1

    I have programmed but I wouldn't call myself a programmer. I don't deserve to use the title. I haven't earned the right, no have I the experience, to use that title.

    So, pardon my ignorance, but could you explain why, in layman's terms, anyone would want to do this?

    For shits and giggles. Or to say that you can.

    Other than that....I can think of no serious reason to do this.

  25. Re:Haven't they buried this yet? by ShanghaiBill · · Score: 1

    you don't need an embeded interpreter.. you are already "interpreting it" to jvm

    Languages like Java and C can be compiled into a fixed stream of bytecode or machine instructions. Perl, like Lisp and Javascript, doesn't work that way. These languages can assemble snippets of their own source code at run time, and then interpret and run them on the fly. This is very common in Lisp, and runtime evaluation happens in most Lisp programs. In Javascript, runtime evaluation is considered to be bad style, and many bug detectors like "JSHint" will complain about it. Perl is in between. Most Perl programs don't do it, but it is fairly common, and most perl hackers will be familiar with it.

  26. Re: Haven't they buried this yet? by __aaclcg7560 · · Score: 1

    [...] the group of people you spend your time with is not slashdotters.

    Funny you should mention that... none of my coworkers have ever heard of Slashdot. Seems like Slashdot is a leftover relic of the dot com bust.

  27. Re: Haven't they buried this yet? by MillionthMonkey · · Score: 1

    What I find disappointing is that it only converts Perl 5 to JVM bytecode. All the cool kids are using Perl 6!

  28. UTF-8 error. by cheesybagel · · Score: 1

    "FlÃvio"? His name is Flávio.

    2017. And people still have websites which can't process UTF-8 properly. Jesus.

  29. SoylentNews supports UTF-8 by xororand · · Score: 1

    SoylentNews is forked off Slash and supports UTF-8.
    The downside is that SoylentNews doesn't include 5000 external JavaScript resources as a modern site should.

  30. Re:Haven't they buried this yet? by Xest · · Score: 1

    The whole point in JIT compilation is that it compiles "Just In Time", that is, just in time to execute - to do something like eval you merely JIT the section of script you want to eval when you eval it.

    I'm a little out of date on Java, it's been a while, but alternatively if it supports something like .NET's DLR you simply generate expression trees for execution at runtime and execute those.

    Depending on semantics, you may wish to call these options "interpreters", and I've got some sympathy for that argument given that the boundary between interpreted and JIT'd languages has become ever more blurred - C#'s DLR, HHVM for PHP, and V8 for JavaScript all make the distinction ever less simple. But this really proves the point - the idea of implementing something like eval in a JIT'd language isn't new, because that's exactly what happens for existing classically interpreted languages like JavaScript that are now more commonly JIT compiled.

  31. perl and java in a tree... by fuzzywig · · Score: 1

    And now you have two problems...

  32. Re: Haven't they buried this yet? by __aaclcg7560 · · Score: 1

    All the cool kids are using Perl 6!

    When is Perl 6 supposed to come out? ;)

  33. Solution in search of a problem by ebvwfbw · · Score: 2

    While it may work and all... why? Why translate Perl that will run, runs well, doesn't have any of the problems of Java... why move it into java?
    Someone after a rube goldberg award?

  34. Re: Haven't they buried this yet? by peawormsworth · · Score: 1

    Perl is a language that I heard about, never used and don't know anyone who had used it.

    You should look up Mark Zuckerberg. You never heard of him I guess, but he's very social and has lots of friends. He runs a little site I like to call the facebook.

    Also, there is an old software project called "Slash". It was written in Perl, but probably ran on websites you never used or heard of.

  35. Java to Perl? by LesserWeevil · · Score: 1

    Personally, I'd find a Java-to-Perl converter more useful. Lots of good dev environments for Java, not so much for Perl.

  36. Re: Haven't they buried this yet? by __aaclcg7560 · · Score: 1

    You should look up Mark Zuckerberg.

    The greatest PHP programmer that ever lived. I just got finished reading "Chaos Monkeys: Obscene Fortune and Random Failure in Silicon Valley" by Antonio Garcia Martinez. The author sold his company and engineers to Twitter and joined Facebook in a three-way deal. He complained about using PHP for the frontend at Facebook. You would think a Harvard-educated programmer would use a better language for his webpages than PHP. I'm not going to knocked him for using PHP as it was part of the LAMP stack.