harangzsolt33 has asked for the wisdom of the Perl Monks concerning the following question:

I am just curious, are there any programming languages that when compiled turn into a plain perl script? For example, JavaScript has CoffeeScript which is a "sub-language" of JavaScript, and when compiled, it results in plain JavaScript code.
  • Comment on Are there any sub-languages or subsets of perl?

Replies are listed 'Best First'.
Re: Are there any sub-languages or subsets of perl?
by Corion (Patriarch) on Feb 08, 2019 at 07:16 UTC
      WOW, those are interesting! I looked at each link you've mentioned. So, in Perl, even the try catch scheme is done by a filter, it seems. So, the language itself is very versatile. That's very interesting, because I don't know any other programming language that can be molded or shaped like Perl. I can imagine that it can be a pretty difficult task to write an editor that does syntax highlighting for perl code, because there can be so many variations. LOL https://metacpan.org/pod/TryCatch
        > even the try catch scheme is done by a filter

        I don't see how "without source filters" can make you think so. Also, there's no "the" try catch scheme, following the TIMTOWTDI principle, there are many of them, see e.g. How fast can you try?

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        It's pretty much impossible to write a 100% accurate syntax highlighter for Perl anyway.

Re: Are there any sub-languages or subsets of perl?
by Your Mother (Archbishop) on Feb 08, 2019 at 07:30 UTC

    I wouldn't call CoffeeScript and friends sub-languages. I believe superset language is used, I'm not sure if there is a preferred/best term.

Re: Are there any sub-languages or subsets of perl?
by Eily (Monsignor) on Feb 08, 2019 at 10:24 UTC

    I guess it can kinda be said of awk with a2p, although awk also has its own interpreter, and a2p can't translate all awk programs into perl (can't have a regex input record separator in perl). You could consider that there's a "pawk" language which is nearly identical to awk, but gets turned into perl.

Re: Are there any sub-languages or subsets of perl?
by LanX (Saint) on Feb 08, 2019 at 21:34 UTC
    I agree with Your Mother that coffee script is rather a super language because it generates JS.

    A sub language would be a sub set of JS.

    To answer your question any DSL which generates Perl would be a similar super language.

    If the DSL is implemented internally in Perl it's also a sub language

    You see it depends on the way it's parsed and what kind of code it emits.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

    PS: DSL means Domain Specific Language, as such it should be restricted to a specific domain. Perl is supposed to be a all purpose language.

    I'm not aware of a full scale language which compiles to Perl5, there are some (hypothetical ?) projects to do this with Perl 6.

Re: Are there any sub-languages or subsets of perl?
by Anonymous Monk on Feb 08, 2019 at 13:33 UTC
    No, we have "sister languages" instead.
Re: Are there any sub-languages or subsets of perl?
by harangzsolt33 (Deacon) on Feb 09, 2019 at 04:43 UTC
    Well, thank you for all your answers. This was very informative. Yes, I think, I should have said "sister languages." Haha (Sorry, English is my second language, so that word didn't come to my mind.)