atrodo / Plywood

Alternative Perl5 Parser
Other
4 stars 0 forks source link

New Syntax #1

Open philiprbrenan opened 4 years ago

philiprbrenan commented 4 years ago

Hi Jon:

I can see you have put a lot of hard work into this. Might it be possible to use your technique with an improved syntax? After all, we already have a parser for the current, rather dated syntax. As your parser would only be invoked when triggered by the appropriate use statement, it would be feasible, perhaps desirable, to use an improved syntax which would be used to generate (as you do now) an appropriate op tree that the Perl 5 runtime could interpret as usual.

May I propose that the full power of Unicode be exploited? I.e. Variable, keyword and operator names could (for example) be drawn from subsets of: https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols. Any remaining ASCII text might be interpreted as strings. Thus the canonical Hello World program might reduce to something as small as:

𝐬𝐚𝐲 Hello World

The first word is a function. The remainder of the line is an ASCII string. There is an implied semicolon at the end of the line as in Javascript.

By doing something this bold we would move Perl from the trailing edge of language development to the cutting edge. "What, you cannot define your own operators like: β–· in Python? You need Perl with "use Gentle;"

Thanks for your consideration of this very important matter.

Phil

atrodo commented 4 years ago

Hi Phil,

That is the eventual goal of this: to enable new or improved syntax through this module. Before I can do that, however, the original syntax needs to be mostly if not completely replicated. This is because I'm not only using the original syntax rules as a base but also the op-tree construction functions. All of those pieces need to be vetted and verified first. After that initial work is done and there is a good underlying base for constructing a language, this should be able to be used to improve perl syntax or produce an altogether new syntax.