clarity20 / miniquery

TUI front end for TQL.
1 stars 0 forks source link

Query syntax redesign to resolve command ambiguities and expand SQL coverage #26

Closed clarity20 closed 2 years ago

clarity20 commented 4 years ago

Miniquery is designed for terseness ("expressive density"). For greatest usability, the syntax should align with categories of thought that go into writing queries. Disjoint modes of thinking should be straightforwardly fenced off in the syntax. What we DON'T want is a jumble of deceptively simple statements whose meanings depend on system state or threaten to "quantum tunnel" into each other.

The revamped syntax will have several aspects:

Prefixes go way back: '-' means option, '+' means postselect, etc. We should make sure they consist only of symbols; no more '+1' for preselects. The classifier will sort the arguments by prefix (including the null prefix) without attempting to interpret them.

Operators include := for UPDATE clauses, .= for INSERTs, etc. This is really an expansion of the syntax, not so much a change. Consider allowing some operators to have context-sensitive meanings (especially +=). Perhaps allow 3-character operators for infrequent use cases.

Modes, as in DML mode / DDL mode / whatever mode, can determine what we look for to understand a command. But they are an extra piece of program state that adds to the user's cognitive burden and invites syntactical "quantum tunneling." So let's just add new commands such as \select, \insert, and \droptbl. (This obviates the proposed "bang syntax" of #21.) Also, interpolate the right DML command when none is specified. N.B. The system will need to know these are not system commands but a different class of command, i.e. the arguments that follow are in the Miniquery language, properly speaking.

clarity20 commented 4 years ago

More specifics about operators and prefixes should be added here. As a start, #21, which was subsumed into this ticket, contains some good notes.

clarity20 commented 2 years ago

The argumentClassifier class has been fleshed out in detail to accommodate a revamped syntax as described above. The system knows how to distinguish system commands from queries. We can probably do without explicit modes (DML, DDL, etc.)