TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C--

553 pointsby msvanover 11 years ago

21 comments

carterschonwaldover 11 years ago
Hey everyone, I&#x27;d like to point out that the c-- domain is no longer cminusminus.org, the historical site can be found on norman ramsey&#x27;s homepage here <a href="http://www.cs.tufts.edu/~nr/c--/" rel="nofollow">http:&#x2F;&#x2F;www.cs.tufts.edu&#x2F;~nr&#x2F;c--&#x2F;</a> ! It also has actual reading material &#x2F; papers!<p>The cminusminus domain is no longer valid (though it has more modern CSS), also it lacks links to all the informative papers!<p>C-- is very similar overall to LLVM IR, though there are crucial differences, but overall you could think of them as equivalent representations you can map between trivially (albeit thats glossing over some crucial details).<p>In fact, a few people have been mulling the idea of writing a LLVM IR frontend that would basically be a C-- variant. LLVM IR has a human readable format, but its not quite a programmer writable format!<p>C-- is also the final rep in the ghc compiler before code gen (ie the &quot;native&quot; backend, the llvm backend, and the unregisterized gcc C backend).<p>theres probably a few other things I could say, but that covers the basics. I&#x27;m also involved in GHC dev and have actually done a teeny bit of work on the c-- related bits of the compiler.<p>relatedly: i have a few toy C-- snippets you can compile and benchmark using GHC, in a talk I gave a few months ago <a href="https://bitbucket.org/carter/who-ya-gonna-call-talk-may-2013-ny-haskell" rel="nofollow">https:&#x2F;&#x2F;bitbucket.org&#x2F;carter&#x2F;who-ya-gonna-call-talk-may-2013...</a> <a href="https://vimeo.com/69025829" rel="nofollow">https:&#x2F;&#x2F;vimeo.com&#x2F;69025829</a><p>I should also add that C-- in GHC &lt;= 7.6 doesn&#x27;t have function arguments, but in GHC HEAD &#x2F; 7.7 and soon 7.8, you can have nice function args in the C-- functions. See <a href="https://github.com/ghc/ghc/blob/master/rts/PrimOps.cmm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ghc&#x2F;ghc&#x2F;blob&#x2F;master&#x2F;rts&#x2F;PrimOps.cmm</a> for GHC HEAD examples, vs <a href="https://github.com/ghc/ghc/blob/ghc-7.6/rts/PrimOps.cmm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ghc&#x2F;ghc&#x2F;blob&#x2F;ghc-7.6&#x2F;rts&#x2F;PrimOps.cmm</a> for the old style.
评论 #6622706 未加载
m_muellerover 11 years ago
Could someone enlighten me what&#x27;s the advantage of this over LLVM-IR?<p>Edit: Ok, I&#x27;ve found the following SO thread: <a href="http://stackoverflow.com/questions/3891513/how-does-c-compare-to-llvm" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;3891513&#x2F;how-does-c-compar...</a>
评论 #6621923 未加载
评论 #6622193 未加载
peapickerover 11 years ago
When I first entered college in 1988 there was a small DOS compiler floating around called C-- back then, which I got from some BBS (yes, a BBS, how antiquated!), probably in 1989. It was a mix of a subset of C and proto-assembly. I have looked for it a few times over the years, and this one isn&#x27;t it, although it has some similar ideas. It makes me wonder how many other little-known C-- projects there are.
评论 #6622221 未加载
sambeauover 11 years ago
According to this, C-- is still a large part of the Glasgow Haskell Compiler. It looks like (Fig 5.2) code goes into C-- before being translated to LLVM.<p><a href="http://www.aosabook.org/en/ghc.html" rel="nofollow">http:&#x2F;&#x2F;www.aosabook.org&#x2F;en&#x2F;ghc.html</a>
评论 #6622936 未加载
gdonelliover 11 years ago
&quot;As of May 2004, only the Pentium back end is as expressive as a C compiler. The Alpha and Mips back ends can run hello, world. We are working on back ends for PowerPC (Mac OS X), ARM, and IA-64. Let us know what other platforms you are interested in.&quot;
jliptzinover 11 years ago
I own the cminusminus.com domain. Was planning on using it for a blog, mainly to post horrible c&#x2F;c++ code snippets I come across. If anyone wants it, let me know.
评论 #6624414 未加载
评论 #6624862 未加载
secoifover 11 years ago
According to this infographic, a C-- was the influence for JavaScript.<p><a href="http://www.georgehernandez.com/h/xComputers/Programming/Media/tongues-cleaner.png" rel="nofollow">http:&#x2F;&#x2F;www.georgehernandez.com&#x2F;h&#x2F;xComputers&#x2F;Programming&#x2F;Medi...</a><p>If this has any truth (perhaps a different c--?) I&#x27;d like to know which one is being referred to.
评论 #6622165 未加载
评论 #6622157 未加载
评论 #6627379 未加载
评论 #6622160 未加载
cylinder714over 11 years ago
Another take on portable assembly languages is Dan Bernstein&#x27;s qhasm: <a href="http://cr.yp.to/qhasm.html" rel="nofollow">http:&#x2F;&#x2F;cr.yp.to&#x2F;qhasm.html</a><p>An overview here: <a href="http://cr.yp.to/qhasm/20050129-portable.txt" rel="nofollow">http:&#x2F;&#x2F;cr.yp.to&#x2F;qhasm&#x2F;20050129-portable.txt</a>
Radimover 11 years ago
The originality (and practicality!) of choosing the name &quot;C - -&quot; leaves me speechless.
评论 #6621890 未加载
评论 #6622436 未加载
评论 #6636235 未加载
评论 #6624323 未加载
protomythover 11 years ago
I must be missing something since I see the line &quot;The specification is available as DVI, PostScript, or PDF.&quot;, but cannot find any download link.
评论 #6624180 未加载
vezzy-fnordover 11 years ago
This is pretty old. I don&#x27;t know if anyone else besides the GHC team use it?
评论 #6621884 未加载
评论 #6621921 未加载
ohwpover 11 years ago
Wow, I was surprised by the content of the website. I think this is how a website should be.<p>First they are talking about the problem and then they present the solution.<p>I also like the words that are marked bold.<p>This is how interaction design should be done (imho).
sanxiynover 11 years ago
For another take on this area, I recommend reading about Pillar from Intel. <a href="http://dl.acm.org/citation.cfm?id=1433063" rel="nofollow">http:&#x2F;&#x2F;dl.acm.org&#x2F;citation.cfm?id=1433063</a>
mrcactu5over 11 years ago
this seems really awesome, but I have no idea what it does?<p>I know that Python compiles to C and that Clojure compiles to JVM (or even to JavaScript).<p>My cartoon:<p><pre><code> scripting lang --&gt; programming lang --&gt; native code </code></pre> Honestly, I have never experimented with Assembly language much except for COOL (<a href="http://en.wikipedia.org/wiki/Cool_(programming_language)" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Cool_(programming_language)</a>) and TOY (<a href="http://introcs.cs.princeton.edu/java/52toy/" rel="nofollow">http:&#x2F;&#x2F;introcs.cs.princeton.edu&#x2F;java&#x2F;52toy&#x2F;</a>).
评论 #6621919 未加载
评论 #6621917 未加载
评论 #6622036 未加载
jdc0589over 11 years ago
Cool! the first parser&#x2F;compiler I wrote was for C-- (the version that is a small subset of C, not this one). Had not even heard an mention of the different C-- languages for a few years now.
paulhodgeover 11 years ago
Would C-- be a good choice for JIT machine code generation, or is it mostly for static compilation?
EGregover 11 years ago
How does C- compare to CIL of .NET?
评论 #6622984 未加载
ErsatzVerkehrover 11 years ago
Where can I find a code example?
EGregover 11 years ago
If the language is called C-, how come the website is named Cminusminus?
davebeesover 11 years ago
Is the &#x27;minus minus&#x27; being converted into a dash throughout?
评论 #6622011 未加载
Dewieover 11 years ago
Say you&#x27;re writing a compiler for a language in Haskell, and you want to generate machine code rather than having it be interpreted. Is C-- a natural choice on this platform? Or might LLVM be a better choice?
评论 #6622568 未加载