Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming

CJIT - C, Just In Time! (dyne.org) 22

Long-time Slashdot reader jaromil writes: As a fun project, we hacked together a C interpreter (based on Tiny C Compiler) that compiles C code in-memory and runs it live.

CJIT today is a 2MB executable that can do a lot, including call functions from any installed library on Linux, Windows, and MacOSX.

Slashdot reader oliwer points out "they are also including a REPL, which could be interesting." And the CJIT web page promises there's "no EULA to sign, no IDE to install... 100% Free and open source!"

It also says the project was inspired by Terry Davis (TempleOS) and Fabrice Bellard (Tiny C Compiler).

CJIT - C, Just In Time!

Comments Filter:
  • by flyingfsck ( 986395 ) on Sunday December 01, 2024 @01:45PM (#64983555)
    C is my favourite most hated computer language and I use it for everything. I would certainly look into this new tool and will probably hate it just the same.
    • C interpreters aren't new.

      I first used one back in the 1980s.

      They don't work very well. C isn't designed to be an interpreted language.

      • It's compiled "in-memory." It is not "interpreted" per se.

        • It's compiled "in-memory." It is not "interpreted" per se.

          The problem is that small changes, such as tweaking a header file, can have global effects.

          So, incremental compilation doesn't work very well.

          You can kinda sorta make it work most of the time but with lots of limitations.

          Languages designed for interpretation, such as Python, or for incremental compilation, such as Java, don't have the same problems (although they have different problems).

        • by dfghjk ( 711126 )

          But t's value-add is presumably interactive development because it is used like an interpreter. It's a modified interpreter with better performance, something of value to no one these days.

          • Or custom plugins in other products, just like what you can do with Lua on nginx, or custom rules in firewalls or other similar engines. Throw in some sandboxing and you have a very powerful/dangerous tool.
        • by tlhIngan ( 30335 )

          It's compiled "in-memory." It is not "interpreted" per se.

          Many interpreted languages are compiled in memory. Python, for example, isn't executed line by line, but compiled for a virtual machine bytecode and that bytecode is executed.

          But it's still considered an interpreted language because you just run the code directly even though there's an implicit compile and link step that happens when you run the code.

          It's a very fine distinction these days

          • by narcc ( 412956 )

            We often use the term 'compile' informally to refer to programs that translate programs to a machine code, but, strictly speaking, a compiler is a program that translates a program written in one language into another. An interpreted language that didn't use some intermediate representation would be very odd. The only one I could come up with off-hand was Lisp, but it seems silly to draw a distinction on that basis when all we could say is "we have compiled languages and an interpreted language called Lis

      • by ceoyoyo ( 59147 )

        The hair on all the Java people's backs just went up and now they're hissing at you.

    • by gweihir ( 88907 )

      C is the worst language available, except for all others that have been tried.

      Well, not quite. But essentially all programming languages suck. The right tool for the right task makes them suck a bit less and for many tasks, C is it.

  • Seem to recall this product from the 80's, worked really well with better diagnostics than the c compilers of the era...
  • Flappy Bird is bigger than that...

    Anyway, great job! It's fun to see news about a good old-fashioned "we did it because we could" open-source nerd project.

  • Dr. Dobb's 1989 (Score:5, Informative)

    by laughingskeptic ( 1004414 ) on Sunday December 01, 2024 @02:50PM (#64983653)
    Herbert Schildt, "Building your own C interpreter", Dr. Dobb's Journal, 1989, Volume 14, Issue 8 pp. 38 - 49
  • by geekprime ( 969454 ) on Sunday December 01, 2024 @02:58PM (#64983667)
    I still have my original copy on floppy disk. According to the internet archive, Run/C 1.20 by Age of Reason Co. Publication date 1985-04-26
  • Where is the Javascript version so it can run in the browser window?

  • Fabrice Bellards Tiny C Compiler is a brilliant piece of work, a very fast, light, full featured C99 compiler for x86-32/64 or Arm in about 400k or so. I still use it from time to time.

"Consider a spherical bear, in simple harmonic motion..." -- Professor in the UCB physics department

Working...