A Dialect that Isn't Linear-Logic

Biases

I believe I want this language to have these features and attributes:

Terminals

A unary starts with a letter and each of its other characters is a letter, a digit, or a hyphen; however, the last character is not a hyphen.

A binary is one of + - * / @

A keyword looks like a unary immediately followed by a colon, with no space. foo:.

If an expression starts with a unary or a keyword that starts with an uppercase letter, the unary or keyword is understood to be defined in a software library.

We have the usual integer literals. 12. For a negative, write 12 negated.

Character literals use single quotes. 'x', '\n'.

Symbol literals use backquotes? `foo`.

Strings use double quotes. "foo".

Parentheses don't have to have spaces inside of them to be recognised as punctuation.

Grammar

param ::= unary | "(" binary ")" | "(" keyword ")"

Param ::= Unary | "(" Keyword ")"

exp0 ::= param | lit | "(" exp ")"

exp1 ::= exp0 | term unary

exp2 ::= exp1 | exp1 binary exp1 | binary exp1

exp3 ::= exp2 | exp3 keyword exp2 | keyword exp2

lambda-exp ::= "\" param exp

let-exp ::= ":=" param exp "." exp

exp ::= exp3 | lambda-exp | let-exp

library-update ::= ":=" Param exp "!"

Basic Library

or Prelude, if you will.

Dictionary

A dictionary maps from symbols to any values. It contains a finite collection of explicit mappings, and a default value to return when queried on a key that isn't in the explicit list. The name "Dictionary" from the standard basic library gives the empty dictionary. The empty dictionary contains no explicit mappings. In the default case it will fail or return a value denoting failure.

@ aSymbol

gives the value that the dictionary is holding for aSymbol.

exceptAt: aSymbol having: aValue

gives a dictionary that is like the given dictionary, except that the value it holds for aSymbol is aValue.

exceptWithoutKey: aSymbol

gives a dictionary that is like the given dictionary except without any explicit mapping from aSymbol.

else: aValue

gives a dictionary that is like the given dictionary, except that the value it gives in the default case will be aValue.

Problem: how to provide a convenient way to define multiple keywords so that if you supply all of them any any order the result will be the same.

indeed

Suppose the value answered by this is given by t. Then t foo is the value of `foo` in the dictionary, t + bar is the result of applying the value for `+` in the dictionary to the value of bar, and t baz: bletch is the result of applying the value for `baz:` in the dictionary to the value of bletch.

Hosted by www.Geocities.ws

1