5 ms·
Welcome to C-- (2008)
- ToJans 5y agoIn the early 90's, C-- was the bee's knees in our local demo scene. We were dabbling around with turbo Pascal a lot, until this gem appeared. I have fond memories of building mod players and mode 13 fx in a jiffy. 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...
- ck45 5y agoI remember having copied an interpreter for a c like language called “C - -“ (without the spaces), from a shareware cd-rom. It didn’t have pointers (minus pointers), and also was missing something else (the other minus). Was it that language?
- jossik 5y agoYes, it's was different C--: http://c--sphinx.narod.ru/ http://c--sphinx.narod.ru/ Also sources and backup copy of site: https://github.com/jossk/c--sphinx https://github.com/jossk/c--sphinx
- xvilka 5y agoI started[1] to update it (required for some KolibriOS[2] programs) to support *nix systems and modern runtimes. Pull requests are welcome. [1] https://github.com/KolibriOS/cminusminus https://github.com/KolibriOS/cminusminus [2] http://kolibrios.org/ http://kolibrios.org/
- codetrotter 5y agoSort of off topic but I am guessing you put space between those two minus signs because iOS turns two consecutive minus signs into “—”; the “em dash”. 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-- https://youtube.com/shorts/xNxFKLjTGeI https://youtube.com/shorts/xNxFKLjTGeI
- sildur 5y agoYou could also go to Settings, Keyboards, and uncheck Smart Punctuation.
- codetrotter 5y agoTrue. Personally I generally like the smart punctuation though, and will rather work around the few cases where it does something I don’t want.
- southerntofu 5y agoWhen will our tools stop imposing "their" will upon us? I still miss simple T9 correction whenever i want to type a word on Android: it was harder to get it right, but once it was the word didn't change under your feet the second you pressed space to write another word.
- JeremyBanks 5y ago
- andrewshadura 5y agoIn fact, there were at least two completely different programming languages called C--. This one seems yet another one
- andai 5y agoThis one (the OP) is used by the Glasgow Haskell Compiler, apparently they still use it? I remember reading it was only used in the early days but I might be confusing it with cfront.
- bradrn 5y agoYes, GHC still uses Cmm as its backend: https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/cmm https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/cm...
- nextaccountic 5y ago> A .cmm file is rather like C--. The syntax is almost C-- (a few constructs are missing), and it is augmented with some macros that are expanded by GHC's code generator (eg. INFO_TABLE()). > (...) > 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.
- dang 5y agoPrevious related threads: The C-- Language Specification (2005) [pdf] - https://news.ycombinator.com/item?id=19429522 https://news.ycombinator.com/item?id=19429522 - March 2019 (27 comments) C--: A Portable Assembly Language - https://news.ycombinator.com/item?id=17966114 https://news.ycombinator.com/item?id=17966114 - Sept 2018 (1 comment)
- suprjami 5y agoNorman is so great. Look at the photos elsewhere on his site of him teaching COMP40 class. That's exactly the kind of person you want teaching you about computer science.
- rado 5y agoLoved the SPHINX C-- IDE for DOS, no idea if it's the same C--
- kvark 5y agoApparently, not! I feel old…
- bradrn 5y agoThough this page doesn’t seem to mention it, the Glasgow Haskell Compiler still uses Cmm as its backend [0]. (Cmm is a close relative of C--, though I’m not sure exactly what the differences are.) In fact, if you pass -ddump-cmm to GHC (or any other one of the -ddump-cmm-* options, [1]) you should be able to see the Cmm code output for any given Haskell program. Alas, it doesn’t seem to work in the REPL, though at least -ddump-simpl (dumping the Core intermediate language) does. [0] https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/cmm https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/cm... [1] https://downloads.haskell.org/ghc/latest/docs/html/users_guide/debugging.html#c-representation https://downloads.haskell.org/ghc/latest/docs/html/users_gui...
- akireu 5y agoAh, I remember that one. Not a fond memory, either. The C-like language is a red herring: what you actually want is the codegen backend, and having any intermediaries between your AST and the codegen's IR will just add inefficiency and uncertainty. Ironically, there are parts of LLVM-like IR poking out of it: at page 43 of the spec pdf there's a table of instructions that have their counterparts in more or less any modern codegen.
- shadowofneptune 5y agoHow do you feel about languages which have a mid-level intermediate representation, between the full language and the true IR? For example: https://blog.rust-lang.org/2016/04/19/MIR.html https://blog.rust-lang.org/2016/04/19/MIR.html
- akireu 5y agoMIR isn't really a language of its own: it's a human-readable serialization of Rust compiler's lower-level AST, an artifact of the language's complexity. It's native to the compiler, so it doesn't need to be parsed, validated and compiled. So it isn't really relevant in this context. 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).
- shadowofneptune 5y agoMy favorite individual feature of this language, reading through the spec, is the explicit tail-call statement: 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.
- rabbits77 5y agoPerl has a similar syntax, it is quite nice 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).
- shadowofneptune 5y agoIt's fascinating to find an idea like that in Perl. Python's developers are hostile to tail-call optimization due to reasons like it complicating debugging.