TNim (TinyNim) is a quasi-interactive REPL
1256 |It is a stop-gap replacement for the functionality that was in old versions of Nim, and is now nim secret (note: nim secret uses the VM in Nim, so it only allows the import of a subset of modules)
1257 |It compiles and runs code similar to the way you would do this, and does this using a shell command in the background ( nim c -r --verbosity:0 --hints:off <file> )
1258 |1259 |Warning: this is SLOW!!. It is a quick and dirty interactive tool, not a sleek and shiny speed demon.
If you need to work with blocks of code as part of some project, then TNim can be primed with this code prior to being run (rather than having to paste chunks of code into TNim). Add this code to the SavedFileName (tnim_dat.dat), then run TNim.
1260 |If the buffers are not cleared (\qc or \c), then the code will remain in the SavedFileName, and will be available next time TNim is run.
1261 | 1262 |Commands:
\?, \h, \help this information. 1263 | \l, \list list the previous code history (w/ line nr's) 1264 | \ln, \listnn list with No (line) Numbers (raw code listing). 1265 | \c, \clear clear the current history buffer. 1266 | \d, \delete [f [t]] delete lines(s) [f [optionally to t]]. 1267 | delete last line if none specified. 1268 | \e, \eval force the eval (compile/run) of the code buffer. 1269 | \ec, \edconfig <editor> define the path/name to an external editor 1270 | (if not defined, uses notepad (win) or vi) 1271 | \ed, \edit edit code in the code buffer. 1272 | (then reloads the code buffer, lists the code, 1273 | and evals (compile/run) the code) 1274 | \r, \read <filename> read code from <filename> and run. 1275 | Saved history is read on startup. 1276 | data from file is auto evaluated after reading. 1277 | \s, \set [<option=value>] set {maxBlocks,indent} 1278 | \v, \version display the name and version. 1279 | \w, \write [<filename>] write code history [to <filename>]. 1280 | \w by itself overwrites saved history (tnim_dat.dat). 1281 | \c followed by \w clears saved history. 1282 | \q, \quit quit, saving code history to tnim_dat.dat file. 1283 | \qc, \quitclear quit, clearing code history in tnim_dat.dat file.1284 |
Vars and Consts
The Vars and Consts Sections is included to provide clues about the TNim internal settings.
1285 | 1286 | 1291 |Vars
1293 |Consts
1313 |-
1314 |
TnimName = "TNim"
1315 | - 1316 | 1317 | 1318 | 1319 |
TnimVersion = 2.01
1320 | - 1321 | 1322 | 1323 | 1324 |
TnimStart = "nim> "
1325 | - 1326 | the TNim prompt 1327 | 1328 | 1329 |
TnimContinue = ".... "
1330 | - 1331 | 1332 | 1333 | 1334 |
SavedFileName = "tnim_dat.dat"
1335 | - 1336 | this file will hold the code you have typed (until cleared), or you can add code to this before file prior to running TNim 1337 | 1338 | 1339 | 1340 |