Hi,
I would like to write a parser in C#. Lets say I have expression like
NOT(NOT(a AND b) OR (c AND d)). I want this to be in Sum of Products for->(a AND b AND NOT c) OR (a AND b AND NOT d). To do that normally in the logic, demorgan rule is applied and then distributivity of AND over OR. I am having problems about it and tried to find a solution on the Net. Some people have suggested to use Antlr but it does not have tutorials enough. Is there any sample program or at least piece of solution? Even simple guidence like "Use bla bla library in C#" is appreciated-
Best regards,
N

Recommended Answers

All 3 Replies

Hi, karismasa, welcome at DaniWeb!
Some time ago I worked on something just that.
I don't have it here at hand, but I let you know more as soon as I can.
See ya:)

Hi, karismasa, welcome at DaniWeb!
Some time ago I worked on something just that.
I don't have it here at hand, but I let you know more as soon as I can.
See ya:)

Thank you for your answer. I will wait your message later on.
Take care

This is a small C# app which parses logical expressions and builds thruth tables out of it. You may have it as is, maybe it helps you maybe not, I don't know. You may change it like you see fit. I know it works for simple expressions, but it is in fact still "under contruction" as they say. Have fun with it and if you have more questions just ask. Succes!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.