[Solved] how can I create a truth table in turbo c [closed]


Let me try to answer your questions.

  1. Yes. There is no reason why you can’t.
  2. You need to write some sort of lexer to turn the expression into tokens. Then you can use the shunting yard algorithm to turn the expression into something you can easily evaluate.
  3. Use the result from (2) and evaluate it in a little stack machine. Set each free variable to all possible combinations to generate a truth table.

Parsing arbitrary languages is not possible in general. A good introduction into compiler construction (which is the subfield you are interested in) is found in the Dragon Book (Compilers: Principles, Techniques, and Tools). It’s a large field though, I recommed you to take a compiler construction class.

Also, consider ditching Turbo C for something recent. Turbo C is ancient and full of weird quirks.

solved how can I create a truth table in turbo c [closed]