in reply to Extending a perl program with Scheme, Lua, or JS

For simple arithmetic operations, you can use Marpa::R2. A simple calculator is shown directly in the Synopsis. I'm not sure whether it exists as a debian package, but I guess it does.

Also, please linkify the link in your post. [id://537912]Is there a way to call lisp from perl?.

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

Replies are listed 'Best First'.
Re^2: Extending a perl program with Scheme, Lua, or JS
by bcrowell2 (Friar) on Feb 07, 2019 at 23:27 UTC

    Thanks, Marpa looks nice. I couldn't get the sample program to run, though:

    Can't locate object method "parse" via package "Marpa::R2::Scanless::G" at b.pl line 24.

    I guess the other disadvantage is that I would then have to design and implement my own language using Marpa. This could be simple for very simple arithmetic operations, but inevitably I can imagine then having to extend it. Probably better to start with someone else's good design and implementation.

      Maybe your version of Marpa is too old? Consult
      perldoc Marpa::R2
      locally instead of the online manual of the latest version.

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