Sunday, May 4, 2014

After bashing the bash...

I've spend quite some time playing around with the usability issues of the console interface, both in windows and linux and embarked on a journey to see what could I improve.

So far the results of my experiments are nice, a simple command line 'readline' in python capable of basic editing like text selection, copy / paste without the mouse, select word, next / prev, etc etc
Thing is, done with a MVC pattern was easy peasy and got done in no time, even adapting it for a windowing environment would be rather trivial but the parsing thing lead me to implement an EBNF reader in python which indeed took a bit of an effort.
The ebnf reader was done with a non-recursive algorithm for performance and limitations related to python for recursive calls (it does support recursive calls but then they're limited and has some issues), in short the core parser is a one-function non-recursive state machine in the order of 200+ lines of python code.

I may release it if there's interest, it's usage is simple: you feed a ebnf text and returns a grammar, you call parse passing a string and returns an AST (abstract syntax tree) so there's no intermediate steps like traditional yacc / lex / bison and so.

Still, on the usability front, played with few ideas, the one i'm currently after is implementing autocomplete and 'in place' editor, what's the in place editor?
Imagine you're typing something, say:

mycommand.py "my string arg is \"1\""

The oddity here is to have to escape the string, i've been wondering about having some sort of 'enter editor mode' key that would let me write the string normally and will escape it for me. for example once the cursor is inside the quotes I could press say ctrl+enter or so and the line switches to something like:

mycommand.py "my string arg is "1""

then just ctrl+enter to exit the 'string edit mode' or just leave the section moving with cursors or shortcuts so as to have it escaped for me.
The idea is simple, while not terribly usable but explores the idea of 'in place specialized editor' that can be used for other things besides auto escaped strings

So next things next, need to plug the ebnf with the autocomplete and do a proof of concept of the in-place subeditor, surely it will take some iterations to get it easily usable.
Then who knows, i'll be poking around with the ebnf and user inputs, maybe something iteresting arises out of it.

-Mat