Thursday, October 13, 2011

Toward a common script grammar

It seems like scripting languages are slowly converging on a small number of common grammars and one structural data representation.


Common Grammars

The two common grammars are (1) simplified C and (2) Smalltalk.

More to the point, the simplification of C includes removing those pesky parentheses in control flow expressions.  I see them dropping everywhere, which I think is probably a good thing.

Anyway, it seems reasonable that most scripting languages' identities are bound by their feature sets and runtime details, rather than their basic grammar, and therefore it's only beneficial that they should converge.  Naturally it won't happen, but it would be nice.  

Alternately, it seems like an ideal scripting language would be able to understand many variants of C grammar, if only because the grammars are so closely related and are, essentially, representing solved problems Solved problems should not have variant grammars.


Common Structure

The structural data rep has little variations, but is essentially curly brackets to hold key-value pairs, a pair operator, and square braces to handle lists.  The data model is more powerful than JSON, and less powerful than YAML, but otherwise looks like them.  Call it JSON with references, or a strict, sane subset of YAML of scalars, lists, hashes, and references.  YSON, perhaps.

Seems that an ideal scripting language would therefore allow the user to specify the pair operator, key decoration, and value decoration.  Should take care of the major players.
 

No comments:

Post a Comment