Xah Language Design

By Xah Lee. Date: . Last updated: .

programing some quick notes of thoughts.

been studying computer languages for years, especially past 2. In past year, i thought of designing my own lang. Here's some sketch.

the most important element of a computer language is its syntax. (John Backus shares similar view)

• each symbol must mean one thing only. No symbol is used for more than one purpose. e.g. each symbol doesn't depend on adjacent symbols for its meaning.

• make use of unicode. It's there.

• Overall, the syntax will be like lisp sexp but with also m-expression. e.g. similar to Wolfram Language with FullForm. (What Mathematica calls FullForm i'll call tentatively Regular Nested Form.)

• the syntax will be completely regular, with a grammar. Mathematica is close to this, no other lang is i know of has regular grammar. Note: lisp syntax has many irregularities

So, to begin with, the Regular Nested Syntax will be like this:

and the “expr” can be any of ① ② ③.

The corner bracket 「」 is similar to lisp's paren.

For example, lisp's (* 5 (+ 3 4)) would be *, 5, 「+,3,4」.

comma is used as separator, not space. Space (U+20) has no meaning whatsoever. Space is used only for visual display or programer's habit of typing it. e.g. 「3 4」 doesn't mean 3*4 as in Mathematica. (there will be painless syntax transformation facilities built into the editor, similar to Mathematica's FrontEnd.)

the m-expression will be spec out later, because there's a lot. (think of Mathematica for now) Each function, such as Map, MapThread, Join, Part, etc will have a operator.

first, few things about matching pair symbols.

• The asterisk 「*」 will be the multiplication operator. Not ×. Because the traditional diagonal cross is too similar to letter x.

the Editor will have built-in tools (example: a button) that changes syntax on the fly. 2 form at least. ① convert any sourc code to regular nested form. ② another standard form for normal reading (similar to Mathematica StandardForm). Any source code can trivially be formatted in one of these forms (by pressing a button)

a little on semantics.

• the lang will be somewhat like Mathematica in that everything should be builtin as much as possible, including all mathematical operations such as integral, derivative, solving equations, like Mathematica.

• possibly, the lang will forbid setting variables. i.e. like Haskell.

• the lang will of course be functional. In fact, consider offering no procedural operation at all.

• the lang will contain no macros (as in lisp). But *possibly* pattern matching (as powerful as Mathematica), but am not sure about pattern matching...

• possibly consider John Backus's Functional-Level paradigm.

• possibly consider a complete point-free syntax.

• there'd be no call-cc or such.

• the lang will probably be dynamically typed, and the types will be mathematical, like Mathematica. e.g. Integers, Real Numbers, Complex Numbers, Roots. No shits such as int, long, float, double.