Apertures provide several benefits:
Use any name: U has no direct keywords, allowing flexibility in naming.
Efficient compilation process: Anything not guarded by an Aperture is sent directly to the parser and processed as user code, ensuring a streamlined compilation process (benchmark results coming soon).
Control all compiler phases: Apertures allow you to define generics, create complex types, and fine-tune hardware attributes similar to alignof in GCC or attributes in Clang.
Extend U grammar: You can define user functions or embed another language to declare your data in formats like YAML or use CSS.
=============¶
An Aperture consists of one or more operators beginning with colon :
or escape \
like ':'
, ':%'
, or '\'
. Apertures interrupt user code processing to enable dynamic code execution. Only operators are allowed as Apertures; no alphanumeric characters can be used.
Since the colon :
and escape \
characters are reserved for Apertures, operators cannot start with these characters.
Apertures provide several benefits:
- Use any name: U has no direct keywords, allowing flexibility in naming.
- efficient compilation process: Anything not guarded by an Aperture is sent directly to the parser and processed as user code, ensuring a streamlined compilation process (benchmark results coming soon).
- Control all compiler phases: Apertures allow you to define generics, create complex types, and fine-tune hardware attributes similar to
__alignof__
in GCC or attr__attributes__
in Clang. -
Extend U grammar: You can define user functions or embed another language to declare your data in formats like YAML or use CSS.
With Apertures, most programming patterns can be expressed. Each aperture has its meaning to cover nearly all compiler phases.
U has the following apertures:
-
Starting with Colon
(:)
:-
Parser Directives – Colon
(:)
: create symbols symbols, or functions. -
Lexer Directives – Percent
(:%)
: scan source code as HTML. -
Keywords – Double Colon
(::)
: create classes with::A
, control flow with::if
. -
Pattern Matching – Question Mark
(:?)
. -
Type & Specification Directives – At
(@)
: annotate value asint
. -
Error Handling Directives – Exclamation Mark
(:!)
-
Concurrency Directives – Pipe
(:|)
: create concurrent or parallel tasks. -
Pointer Directives – Ampersand
(:&)
: manage pointers or references.
-
-
Starting with Escape
(\)
:- Compiler Directives – Escape
(\)
: import files, print value.
- Compiler Directives – Escape
-
Starting with Double Escape
(#)
:- Test Directives – Question Mark
(#?)
: manage unit and functional tests. - Debugging Directives – Exclamation Mark
(#!)
. - Assembly Directives – Dollar
(#$)
.
- Test Directives – Question Mark
For a complete aperture list, see Grammar.
All apertures will be frozen on version 1.0 with community submissions. Feel free to contribute with your ideas.