Welcome to C-- (2008)
cs.tufts.edu
cs.tufts.edu
[0] https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/cm...
[1] https://downloads.haskell.org/ghc/latest/docs/html/users_gui...
sp2_help( bits32 n, bits32 s, bits32 p ) {
if n==1 {
return( s, p );
} else {
jump sp2_help( n-1, s+n, p*n );
}
}
Clang has a similar thing now, but it's an attribute not a language keyword. There's two things I like about it:First, it communicates intent better. For someone not familiar with the principle of a tail call or a sibling call, thinking of it as a goto is easier, and is what the compiler is actually doing underneath to prevent a stack overflow.
Second, it allows for the compiler to see if the tail call is well-formed right then and there. It would then flag an invalid one as an error instead of not optimizing the tail call. This prevents any surprises at runtime.
For a higher-level language than C--, it'd be fun to call this explicit tail-call statement goto, and have no other form of goto statement. It's just as powerful in expression as the classic goto while avoiding its pitfalls.
sub my_funct{
my($x, $y) = @_;
#…
goto &my_funct($x, $y);
}
In Perl this is convenient because effectively with just adding the goto keyword you reduce all the memory use and risk of blowing your stack (recursion is otherwise super inefficient in Perl).The C-- Language Specification (2005) [pdf] - https://news.ycombinator.com/item?id=19429522 - March 2019 (27 comments)
C--: A Portable Assembly Language - https://news.ycombinator.com/item?id=17966114 - Sept 2018 (1 comment)
The combination of high/low level development was super productive for the intro-/demoscene.
Unfortunately, like most of these interesting blend experiments, it disappeared into the infinitely deep pits of legacy after a few years...
To get around that problem, first type either as you did minus space minus, or another character between. Then long press the space bar on your onscreen keyboard so it becomes the movable cursor, move back one step and erase the character you put between.
I like to use “.” as the temporary character in between because it keeps you on the symbols keyboard and is close to the dash.
Allow me to demonstrate: C--
> (...)
> We say that Cmm is GHC's implementation of C--. This naming scheme is not done consistently everywhere, unfortunately. If you are interested in C-- (which have diverged from Cmm), you can check out its specification.
For example: https://blog.rust-lang.org/2016/04/19/MIR.html
Rust aside, I'm fine with using C as a target language, as it's well known and has all sorts of tooling, but inventing a whole new language with a custom syntax just to use a codegen is overkill, especially when there are more than a dozen projects that use SSA-based IR to great effect (from LLVM and golang to game console emulators).