UNPKG

swahili-lang

Version:

A new programming language with semantics borrowed from the Swahili language to help teach programming concepts to Swahili speaking students.

19 lines (16 loc) 616 B
const prompt = require('prompt-sync')(); const SWString = require('../../types/string'); const RTResult = require('../../runtimeResult'); /** * Gets input from STDIN * @param {SWBuiltInFunction} inst the instance of the built in function * @param {Context} executionContext the calling context */ function soma(inst, executionContext) { let res = new RTResult(); let swali = executionContext.symbolTable.get('swali'); swali = swali ? swali.toString(false) : '> '; let textInput = prompt(swali); return res.success(new SWString(textInput || '')); } module.exports = { method: soma, args: ['swali'] };