1:- module(rologpp, 
    2  [
    3    r_init/0,
    4    r_init/1,
    5    r_call/1,
    6    r_eval/2,
    7    op(600, xfy, ::),
    8    op(800, xfx, <-),
    9    op(800, fx, <-),
   10    op(100, yf, []),
   11    '<-'/2,
   12    '<-'/1
   13  ]).   14
   15:- use_foreign_library(foreign(rologpp)).   16:- use_module(library(terms)).   17
   18r_init :-
   19    current_prolog_flag(os_argv, [Argv0 | _]),
   20    r_init(Argv0).
   21
   22:- op(800, xfx, <-).   23:- op(800, fx, <-).   24
   25r_call(Expr) :-
   26    writeln(Expr).
   27
   28r_eval(X, Y) :-
   29    pl2r_(X, R),
   30    r_eval_(R, Y).
   31
   32pl2r_('::'(Namespace, Compound), X)
   33 => term_string(Namespace, Ns),
   34    compound_name_arguments(Compound, Name, Arguments),
   35    pl2r_('do.call'($(getNamespace(Ns), Name), Arguments), X).
   36
   37pl2r_(A =< B, X)
   38 => pl2r_('<='(A, B), X).
   39
   40pl2r_(A[B], X)
   41 => pl2r_('['(A, B), X).
   42
   43pl2r_(Hash, X),
   44    compound(Hash),
   45    compound_name_arguments(Hash, #, Args)
   46 => compound_name_arguments(C, c, Args),
   47    pl2r_(C, X).
   48
   49pl2r_(A, X),
   50    compound(A)
   51 => mapargs(pl2r_, A, X).
   52
   53pl2r_(A, X)
   54 => A = X.
   55    
   56<-(Call) :-
   57    format('<- ~w~n', [Call]).
   58    
   59<-(Var, Expr) :-
   60    format('~w <- ~w~n', [Var, Expr])