Author image Peter Hanely
and 1 contributors

NAME

Language::MPI - 2008.0217 Message Parsing Interpreter

SYNOPSIS

Processor for the Message Parsing Interpreter text composition language, based on the MPI found in MU* online environments, adapted for more general semantics.

http://en.wikipedia.org/wiki/Message_Parsing_Interpreter

USAGE

        use Language::MPI;
        $node = new Language::MPI($noderef);
        $node->setvar("varname", "varval");
        $results = $node->parse("tick {set:varname,{time:}} tock");
        $val = $node->readvar("varname");

MPI assumes an operating environment consisting of a set of nodes each of which has a set of named properties. How these nodes and properties are stored and structured is up to the application except that:

  • noderefs are perl scalars used by application supplied functions. Something with a printable value is encouraged but not required.

  • properties may be identified by and resolve to plain text strings.

MPI, in the interest of more general usage, expects some support subroutines to be supplied by app to access nodes and properties. Should any of these not be supplied, errors are trapped to prevent crashing. Functions not needing these should still work properly. Should the application designer wish, app data to be passed to these callbacks may be set into and read from the object by the setvar() and readvar() methods.

mpi_neighbors($thisnode, $pattern, $obj)

$thisnode is a noderef. $pattern is a string pattern used to specify which nodes 'neighboring' the current node are of interest. returns list of noderefs;

mpi_prop($thisnode, $propname, $obj)

$propname is the string name of a property. returns propval;

mpi_props($thisnode, $proppat, $obj)

$propat is a string specifier to a property directory or a subset of properties. returns list of propnames;

mpi_propset($thisnode, $propname, $val, $obj)

INSTALATION

        perl Makefile.PL
        make
        make install

Or simply copy the MPI.pm file to Language/ under the perl modules directory. README and the man file for this package exist as pod data in MPI.pm.

STATUS

Some MPI standard functions incomplete or unimplimented. Testing incomplete.

Etc

This code developed using perl 5.8.8. Might work with perl 5.6.0 or older with proper libraries. Uses strict and warning.

Copyright (c)2007 Peter Hanely. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

LANGUAGE

VARS

Variable names of alphabetic characters are general MPI use.
Names beginning with an underscore "_" are reserved for mpi internal variables and should not be used by the application.
Names beginning with "\" are suggested for application values placed in the mpi object.

MPI primitives

{abs:num}

{add:num1,num2...}

{and:num1,num2...}

{attr:attribute...,text}

{count:array}

{date:}

{dec:var,dec}

{default:var1,var2...}

{delprop:var[,obj]}

{dice:range[,count[,bonus]]}

{dist:x1,y2...}

{div:num,num1...}

{eq:var1,var2}

{eval:vars...}

{exec:prop[,node]}

{for:varname,start,end,increment,commands}

{foreach:varname,list,command[,list seperator]}

{func:name,var1:var2...,commands}

{ge:var1,var2}

{gt:var1,var2}

{if:condition,true[,false]}

{inc:var,inc}

{index:prop[,obj]}

{insrt:string1,string2}

{lcommon:list1,list2}

{le:var1,var2}

{list:props[,obj]}

{listprops:props[,obj]}

{lit:expression to not parse}

{lmember:list,item[,delimiter]}

{lrand:list[,delimiter]}

{lremove:list1,list2}

{lt:num1,num2}

{lunion:list1,list2}

{lunique:list}

{max:var1,var2...}

{midstr:string,start[,end]}

{min:var1,var2...}

{mklist:list items}

{mod:num1,num2}

{mult:num1,num2...}

{ne:var1,var2}

{neighbors:varname,pattern,code}

{neighbors2:pattern}

{nl:}

{not:var}

{null:...}

{or:var1,var2...}

{prop:property,node}

{rand:props[,obj]}

{secs:}

{set:var,val}

{sign:num}

{smatch:string,pattern}

{store:val,property[,node]}

{strip:string}

{strlen:string}

{sublist:list,pos1,pos2[,sep]}

{subst:string,old,new}

{subt:num1,num2...}

{time:}

{tolower:string}

{toupper:string}

{v:varname}

{version:}

{while:condition,command}

{with:varname...}

{xor:num1,num2...}

-

Public object methods

new(noderef);

Create new MPI object.

$mpi->setvar(var,val);

Sets a variable in the mpi object to a scalar value.

$mpi->readvar(var);

Reads a scalar value from the mpi object

$mpi->parse(string);

Processes a string for MPI codes

1 POD Error

The following errors were encountered while parsing the POD:

Around line 245:

You forgot a '=back' before '=head1'