Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: A minilanguage with the least effort?

by moritz (Cardinal)
on Feb 17, 2009 at 13:21 UTC ( #744398=note: print w/ replies, xml ) Need Help??


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?
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();

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://744398]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2015-07-06 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (71 votes), past polls