http://www.perlmonks.org?node_id=744398


in reply to A minilanguage with the least effort?

The least effort is eval, which can be used to implement a mini-language called "Perl". (Note that this comes with security implications).

The second least effort is to use a CPAN module that implements a minilanguage.

Or of course you can write a parser for it (if it's really mini that's going to be easy) and a backend.

The exact approach varies greatly on what you actually want your minilanguage to do.

  • Comment on Re: A minilanguage with the least effort?

Replies are listed 'Best First'.
Re^2: A minilanguage with the least effort?
by clinton (Priest) on Feb 17, 2009 at 13:27 UTC
Re^2: A minilanguage with the least effort?
by wol (Hermit) on Feb 17, 2009 at 18:28 UTC
    "Security implications"? Surely it would be just as secure as everyone's favourite language: Perl.

    That aside, here's an implementation (complete with syntax checking) for the mini-est language I can think of.

    $_ = <>; die "Syntax Error\n" unless m/^[10]$/; die "Syntax Error\n" if defined <>; exit $_;
    I'll leave it up to you to work out what the valid input is.

    --
    use JAPH;
    print JAPH::asString();