Problem Description: The goal of this exercise is to reproduce in a limited way,
ID: 3868313 • Letter: P
Question
Problem Description: The goal of this exercise is to reproduce in a limited way, an interpreter for a computer language. The language will be defined as the following:
Declaration statements (integer or string only, single-letter names)
Character-string literals (Ex: “Bob joe”)
Simple numeric assignments (Ex: a = b + c, =, , *, /, %)
Simple character-string assignments (Ex: n = “CS110” )
Read (input one integer value)
Display (output integer value or output character-string value)
End-statement (‘end’ signals the end of the program)
The program will be typed by the user, a single statement on each line. The interpreter will read the program in this language and store it onto a text file. Variables will be checked against their declaration statements and each use of an undeclared variable will be flagged as an error. When the ‘end’ statement is reached and stored, the interpreter will check to see if there were any errors flagged. If none, it will begin executing the statements a line at a time. If there were errors, the interpreter will display a summary error message (ex: “too many errors – execution deleted”) and go back to reading user input.
The execution phase will
Display each statement exactly as supplied by the user.
Create an internal variable for each declaration statement
Manipulate values as dictated by the program
Perform read and display statements
When execution reaches the ‘end’ statement, stop!
Explanation / Answer
{
"name": "bin-man",
"version": "0.0.1",
"description": "format and display manual pages",
"bin": {
"man": "man.js"
} ,
"repository": "http://github.com/groundwater/node-bin-man",
"author": "groundwater",
"licencese": "MIT",
"dependencies": {
"blessed": "~0.0.22"
}
}
var path =process.env.home + "/lib/node_modules/" + arg + "/REDME.md";
try{
var readme = fs.readFilesync(path, 'utf-8');
} catch(e) {
console.log('No README.md for package ' ,arg);
process.exit(-1);
}
screen.key(['space' , 'f' , 'j' , 'n' ] , function(ch, key) {
box.sroll(box.height);
screen.render();
} );
screen.key(['down'], function(ch, key) {
box.scroll(1);
screen.render();
} );
screen.key(['up'], function(ch, key) {
box.scroll(-1);
screen.render();
} );
screen.key(['b' , 'k' , 'p'], function(ch, key) {
box.scroll(-box.height);
screen.render();
} );
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.