rrose1 / jsonesharp

A browser-based implementation of the 1# text register machine
GNU General Public License v2.0
6 stars 6 forks source link

Program editor language #6

Open lmoss opened 9 years ago

lmoss commented 9 years ago

The language inside the program editor is called the \emph{vernacular}.

Words from 1# may go in the program editor.
One may enter a snippet of code on a line (or even with wrapped lines).

In addition, the program editor may see commands that use label, goto, eval, and import.

A line starting with "label" should be followed by a string (of letters or numbers).

A line starting with "goto" should be followed by a string.

A line starting with "eval" should be followed by a non-empty sequence of strings.

A line starting with "import" should be followed by some string (or else an error should be raised).

Comments in the program editor: every line may optionally have a semicolon, and in that case everything after the semicolon is a comment.

rrose1 commented 9 years ago

Overloading eval in the interface might create an unnecessary conceptual complication for a user.

I'm also concerned that import conventionally has some baggage (namespaces, in particular) that could be misleading.

I'd prefer to stick to the language of copying, pasting and evaluating strings.

What do you think of these alternatives: insert and eval-insert?

lmoss commented 9 years ago

I think I understand the issues -- there are two -- so let me make some comments.

The first issue is the name of 'import'. I know that 'import' might imply more powerful features than we are delivering on. If this is the case, I'd say to change it to 'insert'. I didn't understand the point about namespaces.

My guess is that most of what we want (in this discussion) is 'import'. The 'eval' is just to make the users' life easier regarding what we might call parametrized programs. I don't see what you mean about 'overloading in the interface' . (Are we overloading?) But I am pretty strongly against making a file system that's hard to use or explain. We aren't doing this for power users.

dasprunger commented 9 years ago

I think the eval overloading Robert is mentioning is the use of "evaluate" as a button to run the current program with the current registers, and the "eval" keyword in the vernacular language. Is that right?

I don't mind dumping "import" in favor of "insert". Another possibility to alleviate naming issues around eval would be to change the button to "run" instead of "evaluate".

The rest of this issue though (name revision aside) has been implemented with the original choices, and I added a few examples to the workshop/library. See in particular metaclear--"eval metaclear 11" clears R2, as does "eval writelastclear 11".