Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement syntactic sugar #6

Open
c3d opened this issue Feb 7, 2020 · 0 comments
Open

Implement syntactic sugar #6

c3d opened this issue Feb 7, 2020 · 0 comments

Comments

@c3d
Copy link
Owner

c3d commented Feb 7, 2020

The documentation now describes various forms of syntactic sugar which, incidentally, make most of the code written at the time of XL2 acceptable again.

Most syntactic sugar transform a prefix notation using some particular word into an infix type annotation with possibly some additions. The words being considered include: type, class, module, function, method, procedure, to, operation, data, in, out, inout, io,
constant, variable, macro, generic, polymorphic, fast, small, global, thread and static.

The transformation are generally similar to the following, and might be implementable fully in the library:

{ type T is Impl } is { T as type is Impl }
{ type T with Interface } is { T as type with Interface }
{ type T inherits Base } is { T like Base }
{ type T like Base } is { T like Base }
{ T inherits Base } is { T like Base }
{ module M is Impl } is { M as module is Impl }
{ module M with Interface } is { M as module with Interface }  
{ procedure Proc is Impl } is { Proc as mayfail is Impl }

There are quite a few more, but the pattern is relatively general and simple.

More direct compiler analysis might be needed for a few cases, but that remains to be confirmed.

c3d added a commit that referenced this issue Feb 12, 2020
Syntactic sugar keywords and usage models are described in
[the documentation](http://c3d.github.io/xl/#syntactic-sugar)

The added keywords added include:

      type class module function method procedure to operation
      data macro generic polymorphic iterator
      fast small global thread static
      in out inout io
      constant variable const var

They all have low priority (PREFIX 30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant