Showing posts with label jack language. Show all posts
Showing posts with label jack language. Show all posts
Saturday, August 12, 2017
Saturday, April 15, 2017
Nand2Tetris Common Issues
../../tools/JackCompiler.bat Fraction/
Compiling "C:\Users....\09\Fraction\"
Could not find file or directory: C:\Users..
Problem - the '/' provided along with directory name. Yes, lame, I know :) Shimon's response : our purpose is didactic, not production :)
while( 1 ) {
}
use while( true ) ...
Aha - API claims drawCircle can handle radius of 181... Nice try there. I just found out you have to stay below 128 (127 is ok)
In Circle.jack (line 23): In subroutine PlotCircle: Expected (
Most likely reason - you used a "do" when you meant to use "let" :) Don't you miss Perl's errors/warnings :) ?
Gotcha - you HAVE to declare ALL variables before any "action".
var int xyz;
let xyz = 0;
var int pqr;
won't fly :)
Compiling "C:\Users....\09\Fraction\"
Could not find file or directory: C:\Users..
Problem - the '/' provided along with directory name. Yes, lame, I know :) Shimon's response : our purpose is didactic, not production :)
while( 1 ) {
}
use while( true ) ...
Aha - API claims drawCircle can handle radius of 181... Nice try there. I just found out you have to stay below 128 (127 is ok)
In Circle.jack (line 23): In subroutine PlotCircle: Expected (
Most likely reason - you used a "do" when you meant to use "let" :) Don't you miss Perl's errors/warnings :) ?
Gotcha - you HAVE to declare ALL variables before any "action".
var int xyz;
let xyz = 0;
var int pqr;
won't fly :)
Labels:
hack computer,
jack language,
nand2tetris,
noam nisan,
project 09,
shimon shocken
Sunday, April 9, 2017
Jack Peculiarities
must be used in assignments: let x = 0;
° The keyword do:
must be used for calling a method or a function outside an expression:
do reduce();
° The body of a statement must be within curly brackets, even if it
contains a single statement: if (a > a) {return 3} else {return -a};
° All subroutine must end with a return
° N0 operator priority:
-- The following value if unpredictable: 2 + 3 * 4
-- To enforce priority of operations, use parentheses: 2 + (3 * 4)
° The language is weakly typed
Labels:
jack language,
nand2tetris,
noam nisan,
shimon shocken
Jack Language Cheat Sheet
class, constructor, method, function Program components
int, boolean, char, void Primitive types
var, static, field Variable declarations
let, do, if, else, while, return Statements
true, false, null Constant values
this Object reference
int, boolean, char, void Primitive types
var, static, field Variable declarations
let, do, if, else, while, return Statements
true, false, null Constant values
this Object reference
Labels:
constants,
identifiers,
jack language,
keywords,
nand2tetris,
noam nisan,
shimon shocken,
symbols
Subscribe to:
Posts (Atom)