MangularJS

From Esolang
Jump to navigation Jump to search

MangularJS (MJS) is a restricted version of NodeJS created by User:PythonshellDebugwindow.

Restrictions

  • No periods or square brackets are allowed in the source code, even in strings, nor are any escape codes that would produce a period or square bracket.
  • The = operator and compound assignment operators are not allowed.
  • All numbers are either integers or NaN.
  • The alert, eval, and require functions are undefined.
  • Division is floor division.
  • The exports, module, and process objects are undefined.
  • The import and export keywords are not allowed.
  • Strings are delimited by colons (:) instead of quotes; colons in strings can't be escaped or replaced by any equivalent escape codes, as these are treated as non-escaped colons.

Examples

Hello, World!

with(console) log(:Hello, World!:);

Stack class

function Stack() {
  return {
    stack: Array(),
    push: function(x) {
      with(this) {
        with(stack) {
          push(x);
        }
      }
    }, pop: function() {
      with(this) {
        with(stack) {
          return pop();
        }
      }
    }
  };
}

See also