Original in Russian: http://programmingmindstream.blogspot.ru/2015/08/blog-post_12.html
Consol script launcher http://programmingmindstream.blogspot.ru/2015/08/blog-post_26.html (in Russian)
Do not forget about script engine stack.
It is almost readable:
(+) https://bitbucket.org/lulinalex/mindstream/commits/1a4d170478480bf9822d80f2170d70a70f1c0ff8
Thing is, EVERY axiomatic primitive was TESTED with atomic tests.
In Other1.
"Pure and simple" TDD.
ANY function was tested, plus reversed through CodeDump.
We test functionality and the result of compilation.
There are tests written for all functions to check main flows by etalon output.
This is Pascal adopted for FORTH.
More simple, Pascal with FORTH.
Simple to write, if you know how - more simple than on Delphi.
Sure, more simple than on classic FORTH.
DUP DROP ROT is a heritage of classic FORTH.
Actually, they are not used at the top level.
(+) http://www.forth.com/starting-forth/
(+) http://fforum.winglion.ru/viewtopic.php?t=1280 (in Russian, I quote below)
(+)
(+)
(+)
(+)
(+)
(+)
(+)
(+)
(+)
Consol script launcher http://programmingmindstream.blogspot.ru/2015/08/blog-post_26.html (in Russian)
Do not forget about script engine stack.
It is almost readable:
i.LULIN-BOOK2 12.08.2015 01:22:45:703 [Stack # 0] : i.LULIN-BOOK2 12.08.2015 01:22:47:634 [Stack # 0] : i.LULIN-BOOK2 12.08.2015 01:22:49:209 Script failed: StackChecking1.ms.script i.LULIN-BOOK2 12.08.2015 01:22:49:209 [Stack # 0] ASSERTS i.LULIN-BOOK2 12.08.2015 01:22:49:209 [Stack # 1] OPERATOR anti-test (Line 696, kwMain.script) i.LULIN-BOOK2 12.08.2015 01:22:49:209 [Stack # 2] anti-test (Line 5, StackChecking1.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:49:209 [Stack # 3] (StackChecking1.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:49:661 Script failed: StackChecking2.ms.script i.LULIN-BOOK2 12.08.2015 01:22:49:661 [Stack # 0] ASSERTS i.LULIN-BOOK2 12.08.2015 01:22:49:661 [Stack # 1] OPERATOR anti-test (Line 696, kwMain.script) i.LULIN-BOOK2 12.08.2015 01:22:49:661 [Stack # 2] anti-test (Line 5, StackChecking2.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:49:661 [Stack # 3] (StackChecking2.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:49:855 Script failed: StackChecking3.ms.script i.LULIN-BOOK2 12.08.2015 01:22:49:855 [Stack # 0] ASSERTS i.LULIN-BOOK2 12.08.2015 01:22:49:855 [Stack # 1] OPERATOR anti-test (Line 696, kwMain.script) i.LULIN-BOOK2 12.08.2015 01:22:49:855 [Stack # 2] anti-test (Line 5, StackChecking3.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:49:855 [Stack # 3] (StackChecking3.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:50:051 Script failed: StackChecking4.ms.script i.LULIN-BOOK2 12.08.2015 01:22:50:051 [Stack # 0] ASSERTS i.LULIN-BOOK2 12.08.2015 01:22:50:051 [Stack # 1] OPERATOR anti-test (Line 696, kwMain.script) i.LULIN-BOOK2 12.08.2015 01:22:50:051 [Stack # 2] anti-test (Line 5, StackChecking4.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:50:051 [Stack # 3] (StackChecking4.ms.script) i.LULIN-BOOK2 12.08.2015 01:22:50:282 [Stack # 0] : i.LULIN-BOOK2 12.08.2015 01:22:50:282 [Stack # 1] USES i.LULIN-BOOK2 12.08.2015 01:22:50:517 [Stack # 0] : i.LULIN-BOOK2 12.08.2015 01:22:50:517 [Stack # 1] USES
(+) https://bitbucket.org/lulinalex/mindstream/commits/1a4d170478480bf9822d80f2170d70a70f1c0ff8
Thing is, EVERY axiomatic primitive was TESTED with atomic tests.
In Other1.
"Pure and simple" TDD.
ANY function was tested, plus reversed through CodeDump.
We test functionality and the result of compilation.
There are tests written for all functions to check main flows by etalon output.
This is Pascal adopted for FORTH.
More simple, Pascal with FORTH.
Simple to write, if you know how - more simple than on Delphi.
Sure, more simple than on classic FORTH.
DUP DROP ROT is a heritage of classic FORTH.
Actually, they are not used at the top level.
(+) http://www.forth.com/starting-forth/
(+) http://fforum.winglion.ru/viewtopic.php?t=1280 (in Russian, I quote below)
"Forth is an extendable programming technique, besides there are no theoretiс boundaries of the level for possible extension - it is possible from registers to the most complex things, modeling of any grammar... though, forthers use it very rarely, if ever use.""This differs Forth from other languages like С - macros extensions begin at the level of abstraction equal to C, С++ has its own limits""Forth is interesting because it allows to modify the modification tools, which is not possible with assembler. Actually, Forth is a cycle executable macroassembler that can modify its own engine from the input flow. That is where the following possibilities arise: from changing the “understanding” of input flow (entering new syntax) and compilation techniques (optimization) up to increasing the semantic power of lexical items to the level which is appropriate for solving tasks of any complexity.""I do not agree totally about Forth as marcoassembler. Not least because Forth forces interaction model within and it is a part of a virtual engine which is quite standartised.As for me, this is a narrow view of Forth. It can change virtual engine and interaction model in run-time.""May be, in some ways, to script languages. Just “dig” on that front:)( since it has no runtime data type identification in base version. Though it is quite typeless.) It can be classified as a language that allows to connect simple elements in a natural way.P.S. After I read the article: Scenarios: high-level programming in XXI century http://www.osp.ru/os/1998/03/179470/ (in Russian) describing the history and capacity of Tcl I thought that syntax and basis of a language has to be simpler. Apart from interface for GUI, Forth can be added by some concepts of Tcl.More about Tcl: http://tclstudy.narod.ru/articles/index.html (in Russian)"
FORWARD Process : Process STRING IN aDir FORWARD ProcessItem : DoDir STRING IN anItem : DoFile STRING IN anItem anItem . ; // DoFile for [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] ( STRING IN aMask @ DoFile aMask anItem ProcessFilesWithMask ) ; // DoDir : ProcessItem STRING IN anItem anItem DoDir @ ProcessItem anItem ProcessSubDirs ; // ProcessItem aDir ProcessItem ; // Process '..\..\' Process
(+)
: Process STRING IN aDir FORWARD ProcessItem : DoDir STRING IN aDir : DoFile STRING IN anFilePath anFilePath Print ; // DoFile for [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] ( STRING IN aMask IterateFilesWithMask aDir aMask DoFile ) ; // DoDir : ProcessItem STRING IN aDir aDir DoDir IterateDirs aDir ProcessItem ; // ProcessItem aDir ProcessItem ; // Process '..\..\' Process
(+)
PROCEDURE ProcessDirs ^ IN aDir FORWARD ProcessItem PROCEDURE DoDir ^ IN aDir PROCEDURE DoFile STRING IN anFilePath PrintThis anFilePath ; // DoFile for [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] ( STRING IN aMask IterateFilesWithMask aDir aMask DoFile ) ; // DoDir PROCEDURE ProcessItem STRING IN aDir DoDir aDir IterateDirs aDir ProcessItem ; // ProcessItem aDir DO ProcessItem ; // ProcessDirs ProcessDirs '..\..\'
(+)
PROCEDURE ProcessDirs RightParam aDir FORWARD ProcessItem PROCEDURE DoDir RightParam aDir PROCEDURE DoFile STRING IN anFilePath PrintThis anFilePath ; // DoFile for [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] ( STRING IN aMask IterateFilesWithMask aDir aMask DoFile ) ; // DoDir PROCEDURE ProcessItem STRING IN aDir DoDir aDir IterateDirs aDir ProcessItem ; // ProcessItem aDir DO ProcessItem ; // ProcessDirs ProcessDirs '..\..\'
(+)
PROCEDURE ProcessDirs ARRAY IN aMaskArray RightParam aDir PROCEDURE DoDir RightParam aDir PROCEDURE DoFile STRING IN anFilePath PrintThis anFilePath ; // DoFile for aMaskArray ( STRING IN aMask IterateFilesWithMask aDir aMask DoFile ) ; // DoDir PROCEDURE ProcessItem STRING IN aDir DoDir aDir IterateDirs aDir ( this.do ) ; // ProcessItem aDir DO ProcessItem ; // ProcessDirs [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] ProcessDirs '..\..\'
(+)
PROCEDURE ProcessDirs RightParam aDir RightParam aMaskArray RightParam aLambda PROCEDURE DoDir RightParam aDir PROCEDURE DoFile STRING IN anFilePath anFilePath aLambda pop:Word:GetRef DO ; // DoFile for ( aMaskArray |^ ) ( STRING IN aMask IterateFilesWithMask aDir aMask DoFile ) ; // DoDir PROCEDURE ProcessItem STRING IN aDir DoDir aDir IterateDirs aDir ( this.do ) ; // ProcessItem aDir DO ProcessItem ; // ProcessDirs ProcessDirs '..\..\' [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] Print
(+)
PROCEDURE ProcessSubDirsWithMasks RightParam aRoot RightParam aMaskArray RightParam aLambda PRIVATE PROCEDURE DoDir RightParam aDir PRIVATE PROCEDURE DoFile STRING IN anFilePath anFilePath aLambda |@ DO ; // DoFile for ( aMaskArray |^ ) ( STRING IN aMask IterateFilesWithMask aDir aMask DoFile ) ; // DoDir PRIVATE PROCEDURE ProcessItem STRING IN aDir DoDir aDir IterateDirs aDir ( this.do ) ; // ProcessItem aRoot DO ProcessItem ; // ProcessSubDirsWithMasks ProcessSubDirsWithMasks '..\..\' [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] Print
(+)
ProcessSubDirsWithMasks '..\..\' [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' ] Print
(+)
PROCEDURE ProcessAnySubDirsWithMasks RightParam aDirMasks RightParam aFileMasks for ( aDirMasks |^ ) ( STRING IN aDirMask ProcessSubDirsWithMasks aDirMask ( aFileMasks |^ ) Print ) ; // ProcessAnySubDirsWithMasks ProcessAnySubDirsWithMasks [ '..\..\' '..\' ] [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' '*.co' ]
(+)
ProcessAnySubDirsWithMasks [ '..\..\' '..\' ] [ '*.ms.script' '*.ms.dict' '*.pas' '*.txt' '*.inc' '*.fmx' '*.xml' '*.dpr' '*.co' ] Print
Комментариев нет:
Отправить комментарий