{"size": 1579, "ext": "js", "max_stars_repo_path": "t.js", "max_stars_repo_name": "janearc/t", "max_stars_repo_stars_event_min_datetime": "2018-11-01T23:39:33.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-01T23:39:33.000Z", "max_issues_repo_path": "t.js", "max_issues_repo_name": "janearc/t", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "t.js", "max_forks_repo_name": "janearc/t", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.0634920635, "max_line_length": 82, "alphanum_fraction": 0.6333122229}
#!/usr/bin/env node

'use strict';

var T = require( 'singleton' ).get();

T.builtins = { };

require( './lib/stdio'       ).init();
require( './lib/list'        ).init();
require( './lib/tokeparser'  ).init();
require( './lib/domain'      ).init();
require( './lib/diag'        ).init();
require( './lib/lexer'       ).init();
require( './lib/interpreter' ).init();
require( './lib/cli'         ).init();

// Set up the T machine
//
T.heap      = { };

// We hit something we really didn't expect, and should get out right away.
//
T.builtins.die = function () { process.exit(-255) },

// T's internal "re-run the interpeter and see if the stack has changed.
// If respin() returns true, there's still something in the stack, and we
// re-execute, top-down. When that while() reaches false, we exit. This
// should eventually be some kind of grown-up cleanup process but that works
// for now.
//
T.builtins.bye = function () { while (respin()) { /* NOP */ } process.exit(0) }

// T needs to be able to read JSON.
//
T.builtins.jsonp = function (s) { return JSON.stringify( s, null, 2 ) }

// The environment for T
//
T.env   = env_sanitise;
T.args  = arg_sanitise;

// For reaching back into the node environment from T
//
T._super = {
	env:  process.env,
	argv: process.argv
};

function env_sanitise () {
	// Lose the not-relevant-to-T things from the Node.js env and wrap in a closure.
	//
	return process.env;
}

function arg_sanitise () {
	// Lose the not-relevant-to-T things from the Node.js argv and wrap in a closure.
	//
	return process.argv;
}

// T.run( T.lex() );
