ans.fs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ( Main file for pure ANS forth JCB 13:53 11/27/10)
  2. : parse-word
  3. bl word count ;
  4. : defer create ( "name" -- )
  5. ['] abort , does> @ execute ;
  6. : include ( "filename" -- )
  7. bl word count included decimal ;
  8. : is ( xt "name" -- )
  9. ' ( xt xt2)
  10. state @ if
  11. postpone literal postpone >body postpone !
  12. else
  13. >body !
  14. then ; immediate
  15. : include ( "filename" -- )
  16. bl parse included decimal ;
  17. : Do-Vocabulary ( -- )
  18. DOES> @ >R ( )( R: widnew)
  19. GET-ORDER SWAP DROP ( wid_n ... wid_2 n)
  20. R> SWAP SET-ORDER ;
  21. : VOCABULARY ( "name" -- )
  22. WORDLIST CREATE , Do-Vocabulary ;
  23. : -rot rot rot ;
  24. : nstime 0. ;
  25. : <= > invert ;
  26. : >= < invert ;
  27. : d0<> d0= invert ;
  28. : f> fswap f< ;
  29. : f<= f> invert ;
  30. : f>= f< invert ;
  31. : f= 0e0 f~ ;
  32. : f<> f= invert ;
  33. 3.1415926e0 fconstant pi
  34. include main.fs