Plastic is a pluggable, flexible, extensible MOOcode parser/compiler.  Plastic currently implements all of LambdaMOO's existing language features, with a few slight deviations from and/or extensions to the original syntax.

Changes and Enhancements

The Plastic parser is not a full fidelity reimplementation of the LambdaMOO language syntax.  Users should note the changes below.

No semicolons required

Semicolons are allowed everywhere they can be used with standard MOOcode syntax, but they are optional in many common cases.  The following are functionally identical:

x = 5;
x = 5

The parser uses special same-line rules to enforce expected behavior in a couple common cases.

  1. The opening parenthesis of an argument list must be on the same line as the name of the function or verb to invoke.  This prevents a lone identifier ending a line from being interpreted as an invocation if the next line starts with a parenthesized expression.
  2. If a value is specified as part of a return statement, the value must be on the same line as the return keyword.

Import syntax

The from/use import syntax introduces a shorthand syntax for verb invocation and property access. It allows the programmer to predeclare the target of an identifier that will be used for verb invocation or property access, and then to use the identifier without the target.

In code that makes frequent use of verbs and properties on $core.utility.time, the following syntax allows the common target to be omitted.

from $core.utility.time use format
from $core.utility.time use months, days
format("$Y") // equivalent to $core.utility.time:format("$Y")
months[$] // equivalent to $core.utility.time.months[$]

The target specified after the keyword from can also be the keyword this or the name of an object in a package as used by $lookup().

from this use log
from "composed|kernel" use reinitialize

New scattering syntax

I changed scattering assignment slightly. In particular, the leading ? is no longer required/allowed in front of parameters with defaults.

Use {a, b = 1, c = 2} instead of {a, ?b = 1, ?c = 2}.

Yes, I know this change removed support for optional but unassigned parameters.

New error catching syntax

Error catching syntax for expressions is simplified. The error catching operator is now the ternary operator !!, and the leading backtick (`) and ending single-quote (') are no longer required.

Use foo !! bar => baz instead of `foo ! bar => baz'.

Double and single quotes

Strings can be enclosed in either single (') or double (") quotes. This alleviates some of the quoting misery I run into and is reasonably prominent in other languages.

Exponentiation operator

The exponentiation operator is ** instead of ^. I am using ^ as a positional operator in a similar fashion to $ to indicate the first element of a list or map in indexed/ranged access.

End

end can be used in place of endfor, endif, and kin. The original endings are supported, as well.