Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hayes test suite - currently passes Core and CoreExt - working through CorePlus #83

Open
8 of 19 tasks
mitra42 opened this issue Jan 19, 2021 · 12 comments
Open
8 of 19 tasks

Comments

@mitra42
Copy link
Owner

mitra42 commented Jan 19, 2021

There is a test suite "forth2012-test-suite" .

Its a little complex to run - and appears to be failing. Will address each fail and fix below

This comment is the META - updated frequently - you can ignore comments xx-yy below
But pay attention to CLEANUP comment which may require other issues to be opened.

Current test process ...

cd forth2012-test-suite-master/src
$> node ../../scripts/forth_2012.js
webFORTH V0.01.00
INCLUDE ../../scripts/forth2012_runtests.fth

And be patient ...

As implement extensions - can uncomment test files in runtests.fth

[ ] Also See "CLEANUP" comment below

@mitra42
Copy link
Owner Author

mitra42 commented Jan 19, 2021

REQUIRE prelimtest.fth

( Pass #1: testing 0 >IN +! ) 0 >IN +! SOURCE TYPE CR
( Pass #2: testing 1 >IN +! ) 1 >IN +! xSOURCE TYPE CR
( Pass #3: testing 1+ ) 1 1+ >IN +! xxSOURCE TYPE CR
( Pass #4: testing @ ! BASE ) 0 1+ 1+ BASE ! BASE @ >IN +! xxSOURCE TYPE CR
( Pass #5: testing decimal BASE ) BASE @ >IN +! xxxxxxxxxxSOURCE TYPE CR
( Pass #6: testing : ; ) : .SRC SOURCE TYPE CR ; 6 >IN +! xxxxxx.SRC
( Pass #7: testing number input ) 19 >IN +! xxxxxxxxxxxxxxxxxxx.SRC
( Pass #8: testing VARIABLE ) VARIABLE Y 2 Y ! Y @ >IN +! xx.SRC
( Pass #9: testing WORD COUNT ) 5 MSG abcdef) Y ! Y ! >IN +! xxxxx.SRC
( Pass #10: testing WORD COUNT ) MSG ab) >IN +! xxY ! .SRC
Pass #11: testing WORD COUNT .MSG
Pass #12: testing = returns all 1's for true
Pass #13: testing = returns 0 for false
Pass #14: testing -1 interpreted correctly

1 2* >IN +! xx.MSG( Pass #15: testing 2*) CR
^^^^^
2* ? (node:38867) UnhandledPromiseRejectionWarning: RangeError: Invalid typed array length: 1024
at new Uint8Array ()
at Flash16_16.buff8 (file:///Users/mitra/git/webforth/index.js:1704:12)
at Forth_with_fs.f (file:///Users/mitra/git/webforth/forth_with_fs.js:119:26)
at Forth_with_fs.threadtoken (file:///Users/mitra/git/webforth/index.js:2644:34)
at Forth_with_fs.runXT (file:///Users/mitra/git/webforth/index.js:2660:33)
at async Forth_with_fs.dINTERPRET (file:///Users/mitra/git/webforth/index.js:2967:7)
at async Forth_with_fs.EVAL (file:///Users/mitra/git/webforth/index.js:2988:9)
at async Forth_with_fs.interpret (file:///Users/mitra/git/webforth/index.js:3018:7)
(node:38867) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

Three issues

  • : A Promise rejection should be handled and result in a "THROW"
  • : Need to dig into how that error occurred.
  • : May need to define 2*
  • : Need to confirm remaining output is as expected.

@mitra42
Copy link
Owner Author

mitra42 commented Jan 19, 2021

CLEANUP

  • Merge code from forth_2012 into index.js
  • Move 2* into index.js ,
  • make 2* a shift rather than 2 * and find potential users
  • Figure out why cant put REQUIRE prelimtest.fth in the preTest string
  • Fix so a syntax error or unknown word doesnt crash
  • Missing ['] https://forth-standard.org/standard/core/BracketTick - immediate, and compile word into dic
    • Need to find use cases to replace - esp in FILE, HAND, QUIT, quit1,
  • [CHAR]
    • find uses of e.g. [ CHAR $ ] LITERAL and replace with [CHAR]
  • Move {T --> }T into index.js from Hayes and replace \?test ...TEST
  • Look for TODO-83

@mitra42
Copy link
Owner Author

mitra42 commented Jan 19, 2021

Pass #20: testing ?F~ ?~~ Pass Error
Pass #21: testing ?~

: TST4 ( -- n ) 0 5 0 DO 1+ LOOP ;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
DO ?

@mitra42
Copy link
Owner Author

mitra42 commented Jan 26, 2021

prelimtest.fth now works - on to rest of runtests.fth

@mitra42
Copy link
Owner Author

mitra42 commented Jan 26, 2021

  • INCORRECT RESULT: T{ -1 0 > -> FALSE }T
  • INCORRECT RESULT: T{ -1 1 > -> FALSE }T
  • INCORRECT RESULT: T{ MIN-INT 0 > -> FALSE }T
  • INCORRECT RESULT: T{ MIN-INT MAX-INT > -> FALSE }T
  • INCORRECT RESULT: T{ 0 -1 > -> TRUE }T
  • INCORRECT RESULT: T{ 1 -1 > -> TRUE }T
  • INCORRECT RESULT: T{ 0 MIN-INT > -> TRUE }T
  • INCORRECT RESULT: T{ MAX-INT MIN-INT > -> TRUE }T*

@mitra42
Copy link
Owner Author

mitra42 commented Jan 26, 2021

  • Missing S>D

@mitra42
Copy link
Owner Author

mitra42 commented Jan 29, 2021

  • INCORRECT RESULT: T{ 2 MAX-INT M* 2 SM/REM -> 0 MAX-INT }T
  • INCORRECT RESULT: T{ 2 MAX-INT M* MAX-INT SM/REM -> 0 2 }T*
  • Missing ALIGN

@mitra42
Copy link
Owner Author

mitra42 commented Jan 29, 2021

  • INCORRECT RESULT: T{ HERE 1 ALLOT ALIGN HERE SWAP - ALMNT = -> }T
  • INCORRECT RESULT: T{ 1ST CELL+ -> 2ND }T \ ... BY ONE CELL
  • INCORRECT RESULT: T{ 1ST 1 CELLS + -> 2ND }T
  • INCORRECT RESULT: T{ 1ST @ 2ND @ -> 1 2 }T
  • INCORRECT RESULT: T{ 1ST 2@ -> 6 5 }T

@mitra42
Copy link
Owner Author

mitra42 commented Jan 30, 2021

  • CONSTANT 1STC says CONSTANT ?

@mitra42
Copy link
Owner Author

mitra42 commented Feb 1, 2021

Needs definitions of .. (this will be edited)

  • TUCK
  • NONAME

@mitra42 mitra42 changed the title Failing Hayes test suite Hayes test suite - currently passes Core Feb 13, 2021
@mitra42 mitra42 changed the title Hayes test suite - currently passes Core Hayes test suite - currently passes Core and CoreExt - working through CorePlus Feb 13, 2021
@mitra42
Copy link
Owner Author

mitra42 commented Feb 23, 2021

  • check Forth2012 definition and check off if matches
    • check naming if non alpha - see Align non alpha names with Forth2012  #86
    • check naming and order of functions XXX (a b -- c ) becomes SPpush(_XXX(b, a))
    • lower case if not standard
    • add {T tests where possible (including for JS words)
    • If its a JS word then check port to Arduino

List of words from forth2012: ABORT ABORT" ABS ACCEPT ACTION-OF AGAIN ALIGN ALIGNED ALLOT AND BASE BEGIN BL BUFFER: [ [CHAR] [COMPILE] ['] CASE C, CELL+ CELLS C@ CHAR CHAR+ CHARS COMPILE, CONSTANT COUNT CR CREATE C! : :NONAME , C" DECIMAL DEFER DEFER@ DEFER! DEPTH DO DOES> DROP DUP / /MOD .R .( ." ELSE EMIT ENDCASE ENDOF ENVIRONMENT? ERASE EVALUATE EXECUTE EXIT = FALSE FILL FIND FM/MOD @ HERE HEX HOLD HOLDS I IF IMMEDIATE INVERT IS J KEY LEAVE LITERAL LOOP LSHIFT MARKER MAX MIN MOD MOVE M* - NEGATE NIP OF OR OVER 1- 1+ PAD PARSE-NAME PARSE PICK POSTPONE + +LOOP +! QUIT RECURSE REFILL REPEAT RESTORE-INPUT R@ ROLL ROT RSHIFT R> SAVE-INPUT SIGN SM/REM SOURCE-ID SOURCE SPACE SPACES STATE SWAP ; S" S" S>D ! THEN TO TRUE TUCK TYPE ' * / /MOD 2DROP 2DUP 2/ 2@ 2OVER 2R@ 2R> 2SWAP 2! 2 2>R U.R UM/MOD UM UNLOOP UNTIL UNUSED U. U< U> VALUE VARIABLE WHILE WITHIN WORD XOR 0= 0< 0> 0<> \ . < > <> #> <# # #S ( ?DO ?DUP >BODY >IN >NUMBER >R ]

@mitra42
Copy link
Owner Author

mitra42 commented Feb 27, 2021

Words From proposals to Forth2012: }T -> FIND-NAME-IN FIND-NAME T{

From eForth and possibly other Forths: ?branch ?CSP ?KEY ?RX ?STACK ?UNIQUE 'BOOT 'ECHO 'EMIT 'TAP #TIB !IO $,n $" $," $COMPILE $INTERPRET !CSP .$ .BASE .FREE .ID .OK ^H >CHAR >NAME branch CSP COLD COMPILE COMPILE-ONLY CONSOLE CONTEXT CP CURRENT CTRL DIGIT DIGIT? EMPTY EVAL EXTRACT FILE HAND hi HLD HANDLER I/O kTAP LAST M/MOD NAME? NEXT NP NUF? NULL$ NUMBER? OVERT PACE PACK$ PRESET PROMPT QUERY RP@ RP! RP0 SAME? SPAN SP@ SP0 SP! TAP TIB TIB0 TOKEN TX! UM+ VER version WARM WHEN XIO

Words from Exceptions word set ABORT ABORT" CATCH THROW

Words that are part of other words - API may change: <MARK MARK >RESOLVE (?do) (charbase) (loop) (+loop) ($,n) ."| $"| '>BODY! AFT (abort") accumulate AHEAD bu+@ c+! cmove\ create crlf? dm+ do$ doLit FOR isspace? isnotspace? leave, leave-ptr (next) (of) pack\$ que quit1 quitError set-header-bits skipCRLF skipToCRLF skip-till some-loop source-id sourcePush sourcePop stringBuffer S"| unreadFile xt-skip

Other: _USER 2RDrop >RESOLVES >MARKSTART >BODY! >MARKTHREAD >RESOLVETHREAD ?\ ?negate ?safe ?test ++ -- -ROT @execute BYTEMASK CELL- COMP debugNA emits Fbreak I-MAX IMED immediate? J-MAX ms stack spop spush spushes sempty str testFlags testDepth ud< userAreaInit userAreaSave vHERE v, vALIGN vALLOT vCREATE VP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant