[nem-en] macro-based syntax extensions.

Ivan A Eryshov ivan.eryshov at gmail.com
Fri Mar 2 07:55:51 CET 2007


Guys,

I have a questions about macro-based syntax extensions.

1. Why syntax extension's keywords can not contain numeric symbols?
Such code will not compile:

<nemerle>
  macro test_1 (x)
  syntax ("test_1", x)
  {
    WriteLine($"x: $x");
    <[ ]>
  }
</nemerle>

2. Can I use in syntax non-keyword at first position?
Following code will compile successful. But, it's usage generates an error.

<nemerle>
  macro test_a (x)
  syntax ("test_a", x)
  {
    WriteLine($"x: $x");
    <[ ]>
  }

  macro test_b (x, l)
  syntax (Optional(l, ":"), "test_b", x)
  {
    WriteLine($"x: $x");
    WriteLine($"l: $l");
    <[ ]>
  }
</nemerle>

<nemerle>
  test_a blablabla;
  label: test_b blablabla; // error: parse error near keyword
`test_b': unexpected keyword in expression context
</nemerle>



More information about the devel-en mailing list