On 05/10/2011 08:54, Walter Bright wrote:
On 10/4/2011 2:46 AM, Jacob Carlborg wrote:
What are the thoughts around here on function names containing arbitrary
symbols, like in Scala. Example:

void ::: (int a) {}

This, in effect, means "user defined tokens". The lexing pass will then become 
intertwined
with semantic analysis. While possible, this will make the compiler slow, buggy,
impossible to run the passes concurrently, hard to write 3rd party parsing 
tools, etc.

Actually, it can be done while keeping the grammar context-free.

One way is to allow certain non-alphanumeric characters to be used to create identifiers. There would be two sets of identifier characters - the current IdentifierStart/IdentifierChar and this new set, and each identifier would contain characters only from one of the sets, not a mixture of both. I believe Prolog does something like this.

Essentially, those tokens made from these characters that are currently defined would be reserved words just like we already have in relation to alphanumeric identifiers.

The disadvantage is that doing this would break existing code that juxtaposes certain symbols, such as
    int** qwert;
    --*yuiop;

Stewart.

Reply via email to