Significantly Prettier and Easier C++ Syntax
{{Expansion depth limit exceeded| left =
| #default = }}
{{Expansion depth limit exceeded| {{{Expansion depth limit exceeded}}}
| [[File:{{Expansion depth limit exceeded| speedy = Ambox speedy deletion.png
| delete = Ambox deletion.png
| content = Ambox content.png
| style = Edit-clear.svg
| move = Ambox move.png
| protection = Ambox protection.png
| notice
| #default = Ambox notice.png
}} | {{Expansion depth limit exceeded| left = 20x20px
| #default = 40x40px
}} |link=|alt=]]
}}{{Expansion depth limit exceeded| left =
| #default = |
{{{Expansion depth limit exceeded}}} |
[[Category:{{Expansion depth limit exceeded|{{{Expansion depth limit exceeded}}}|{{{Expansion depth limit exceeded}}}}}]]
Significantly Prettier and Easier C++ Syntax or SPECS is an alternative syntactic binding for the semantics of C++.
Design
Designed by Ben Werther and Damian Conway, SPECS has a LALR(1) parsable grammar, which means it is significantly easier to parse than standard C++ syntax, both for computers and for humans alike. Also unlike standard C++ syntax, in SPECS declarations do not look like uses. For example, the fundamental C++ allocation control function set_new_handler has this declaration in orthodox C++ syntax:
void (*set_new_handler(void (*)(void)))(void);
which in SPECS becomes:
func set_new_handler : (^(void->void) -> ^(void->void));
and using typedefs in C++:
typedef void (*new_handler)(void); new_handler set_new_handler(new_handler);
and in SPECS:
type new_handler : ^(void->void); func set_new_handler : (new_handler -> new_handler);
Apart from the declaration syntax change, the template syntax is changed to use <[ ]> brackets to make the template keyword unnecessary, several overloaded syntax elements are separated for clarity, := is used for assignment (instead of =), = is used for comparison (instead of ==), blocks for if-, for- and while-statements are mandatory, and there is no fallthrough for switch-statements.
External links
- The Design and Implementation of SPECS: An Alternative C++ Syntax
- A Modest Proposal: C++ Resyntaxed - a shorter version which cites the above
| Stub icon | This computer science article is a stub. You can help Wikipedia by expanding it. |
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...