I'm not saying I want to create a whole new compiler that's completely independent. I'm using C# Windows Forms and I want users to be able to write filtering syntax in a textbox withing my managed application in a basic query language, for example:
inCategory(Animals)
where(animal.age > 40)
take animal;
It's basically a simplifed version of LINQ. But I want this logic to be enclosed in some seperateseparate class, so I can say something like this:
var dataQuery = FilterCompiler.Compile(filterTextBox.Text);
dataQuery.Execute();
I'm not saying 'gimee the code', but some psuedocode / basic logic structure for this 'compiler' would be nice since I am kind of clueless about this subject. Like for example,
- What sort of text analysis would this
FilterCompilerneed to do? - What would be the type of
dataQuery? - Would this require any knowledge of compiler grammar?
- Would I need to use any unmanaged code?
- How can I keep the compiling as independent as possible so that it does not depend too much on what type of data I have? Currently I have a List, but things change, I might have a database with the information in it soon.