The Daily Click ::. Projects ::. Expression Editor Plus (E++)
 

Project: Expression Editor Plus (E++)
Project Started: 11th January, 2008 Last Update: 16th September, 2009
Project Owner: DeadmanDines Project Members:
Project Type: Application Project Progress:

The Story So Far...
Posted 11th Jan 08, by DeadmanDines  
So, this is where it's at so far:

It can currently remove all comments. There are one or two known issues with them, but I can fix them whenever I like - I know what causes them. They mainly arise from things like having one too many /* or */ characters, which (like bracket and "inverted comma" mistakes) will be checked for before processing, so that should iron those out.

Those checks are gonna be some of the last things to work on, I think.

So it can get rid of comments in the // and /**/ formats. It also skips strings. I don't know how other language parsers do it, but I'm just testing every character and advancing the pointer when needed. In the case of strings, it comes across a " character, searches for the next one, and just jumps across. It seems to work fine.

--------------------------------------
Quick Tip:
Some little known functions are the Find() and ReverseFind() functions, built into MMF.

They allow you to look for the first occurence of a string either left (ReverseFind()) or right (Find()) of a character in a string.

If you're building your own language parser, this is fantastic. The //comments, for instance, work by testing if the two characters after the pointer are "//". If so, it'll use Find() to search for the next CRLF (Newline$) in the string, after the pointer position.

Find() will return that character's location, and so we can delete all text between the pointer and that character. Voila! The comment has been removed! The process is the same for /*these comments*/, just using different characters.
---------------------------------------

As of yesterday, it's also beginning to isolate variables. It can find sentences, which end in ";" and then splits them using the "=" sign. An example:

//Code to find the Player's first name, 

//from a full name
//---------
//Load in his full name:
name = Edittext$("NAME");

//Find the first space in the name:
cut to = find(name, " ", 0);

//Extract only the first part:
first name = left$(name, cut to);

//Finally, send MMF the result:
first name

--

Currently, E++ will drill it down to the bear essentials, then isolate the sentences and find the variable names. So it builds a table that says, for instance, that variable 'name' has data 'Edittext$("NAME")'.

So I'm quite chuffed with it so far.

One problem is with MMF's text operators, like MOD, AND, POW, OR and XOR. They can be hard to distinguish from variable names, so I'm having to designate some internal characters to handle them.

So MOD becomes %, POW becomes ^, XOR becomes ~, OR becomes |, AND becomes &, and so on.

I know these aren't all the textbook characters, but mostly people will still use the text equivalent (although typing '24 mod 10' and '24%10' would be the same).

Any comments on this, or suggestions for better operator characters would be appreciated

The screenshot does not show the final User Interface, this is just a development layout.
Preview


No comments have been posted for this post.


 



Project Forums


Favourite

Advertisement

Worth A Click