home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol166 / bsum.rec < prev    next >
Encoding:
Text File  |  1984-04-29  |  762 b   |  43 lines

  1.  
  2. [BSUM.REC]
  3. [sum two binary numbers]
  4.  
  5. [[]]
  6.  
  7. {
  8.   [cr,lf]            (2573TL;)&
  9.   [read phrase]         (R13%='';T08%(=2080[sp,bs]TL)(@J|;L@J;);)J
  10.   [sign-on line]        ('
  11. A Markov Algorithm which will sum two binary
  12. numbers presented in the form a+b=; for example
  13.  
  14.           111110+011=
  15.  
  16. Each successive keystroke will show another step
  17. in the Algorithm until the final sum is completed
  18. and the auxiliary symbols are gone.
  19. 'TL@&'Initial Axiom:'TL@&@JI;:)R
  20.   [write workspace]        (JZqt;)W
  21.   [final statement]        (@&'Production:'TL@&JZqt;)X
  22.                 (@R(@&@WRL
  23.  
  24. 'a0'FD'0a'I:
  25. 'a1'FD'1a'I:
  26. 'b0'FD'0b'I:
  27. 'b1'FD'1b'I:
  28. '0*'FD'1'I:
  29. '1*'FD'*0'I:
  30. '*'FD'1'I:
  31. '0a'FD'=0'I:
  32. '0b'FD'=1'I:
  33. '1a'FD'=1'I:
  34. '1b'FD'*=0'I:
  35. '0+'FD'+a'I:
  36. '1+'FD'+b'I:
  37. '+a'FD'0=+'I:
  38. '+b'FD'1=+'I:
  39. '+'FD''I:
  40. '='FD''I:;;)@X;;)}
  41.  
  42. [end]
  43.