I'm going to be working on Lexical Analysis, but, both in Words / Characters as well as Integer values. The application will also allow input from both Text files, as well as passing the data through arrays, or variables. The Numeric analysis will be different from the Lexical Analysis in a few different ways, but they will each share the same method(s) of parsing in the data (In some way or another).
My first project with using the Lexical Analysis is to create an Application that enables me to pass in a piece of course work, which, parses in the data and then counts the number of words / characters there are, as well as checking for particular keywords that HAVE to be included in the assignment, and then after this, the particular assignment will be converted to PDF.
This is just one of the uses, but, in the future I want to be able to handle (for example) syntax highlighting..
I don't want help with code, I just need some advice on how to structure it..
I was thinking this:
1. Have an interface class that contains all the methods needed
2. Create a a base class that implements this particular interface
3. Create two more classes "Numeric", "Lexical" which inherit from the base class.
Would this work? Or would it better to have an interface for each of the Numeric, Lexical?
But the only problem is handling the methods for say, reading an entire word document, or just reading two arrays (for example). Would I therefore have to somehow override the parser function and then determine whether it's a word file, or it's an array?
The other thing is (lol) I want to be able to implement a new object/method of the object like this:
<?php $this->Numeric->parser("numbers.doc"); // This would then load in a numeric file $this->Lexical->parser("document.doc"); // This would then load in a word/character file $this->Lexical->Characters('GET_NUMBER'); // This returns the number of characters ?>
Could anyone offer any advice? Thanks :)