home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 488.lha / Bool_Parser / Boolean_Parse.Doc < prev    next >
Text File  |  1991-03-05  |  2KB  |  92 lines

  1. Boolean.c           Source code for boolean expression parser.
  2. Boolean            Executable ...
  3. Truth.c            Source code for Truth Table Generator
  4. Truth            Executable ...
  5.  
  6.  
  7. Boolean: A recursive descent boolean expression parser.
  8.  
  9. Boolean accepts literal arguments such as 1|1, 0&1&(1|-1) etc...
  10. It will parse and evaluate them.
  11.  
  12. Run boolean with "boolean [expression_1] [expression_2] ..."
  13.  
  14. Example:  To evaluate (-1&0) type:
  15.  
  16. boolean (-1&0)
  17.  
  18. --------------------------------------------------------------------
  19.  
  20. Valid Operations:
  21.  
  22. The following are supported:
  23.  
  24. - Not
  25. & And
  26. | Or
  27. @ X-Or
  28. * Nand
  29. + Nor
  30.  
  31. ====================================================================
  32. Truth: A recursive descent boolean expression parser & truth table
  33.        generator.
  34.  
  35. Truth functions like boolean except for the fact that truth generates
  36. a truth table.  Integer literals are valid but nothing meaningful
  37. will be generated if there are no variables in the expression.
  38.  
  39. Truth A  Should generate:
  40.  
  41. A Value
  42. -------------------------------------
  43. 0 0
  44. 1 1
  45.  
  46. Truth -A Should generate:
  47.  
  48. A Value
  49. -------------------------------------
  50. 0 1
  51. 1 0
  52.  
  53. Valid Operations:
  54.  
  55. Same as for boolean with the inclusion of variables as valid arguments.
  56.  
  57. Names like ABCDEF are valid but the program sees this variable as 'A'
  58. thus ABCDEF = ANOTHERVAR.  Also, everything is shifted to uppercase
  59. so a = A.  I would suggest sticking to the 26 alphabetical variables.
  60.  
  61. ======================================================================
  62.  
  63. Credit:
  64.  
  65. Herbert Schildt's"C The Complete Reference" has a section on
  66. ^^^^^^^^^^^^^^^
  67. (Now that's a programmer's name if I ever saw one)
  68.  
  69. Expression parsing that I found to be useful.  I structured some of
  70. the code after his mathematical expression parser but not too much
  71. of it.  His parser seemed the most straightforward I had seen so
  72. hopefully this rubbed off into mine somewhat.
  73.  
  74. Recompile the program with:
  75.  
  76. lc -L boolean
  77. or
  78. lc -L truth
  79.  
  80. People using compilers other than Lattice are on their own but there
  81. should not be too many problems since none of the code is all that
  82. tricky.
  83.  
  84. Anyways if any questions arise about anything then simply send mail
  85. to 'pm0@beach.cis.ufl.edu'.
  86.  
  87. Hope these programs help do stuff like generate Karnaugh maps and
  88. such.  Maybe the next version will actually generate the Karnaugh
  89. Map for you...  Who knows, no promises.
  90.  
  91. Patrick Martin
  92.