News: 0175570473

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

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

(Sunday December 01, 2024 @05:29PM (EditorDavid) from the crossing-Java-with-C dept.)


Long-time Slashdot reader [1]jaromil writes:

> As a fun project, we hacked together a C interpreter (based on [2]Tiny C Compiler ) that compiles C code in-memory and runs it live.

>

> [3]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 [4]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 [5]Terry Davis (TempleOS) and Fabrice Bellard (Tiny C Compiler).



[1] https://www.slashdot.org/~jaromil

[2] https://en.wikipedia.org/wiki/Tiny_C_Compiler

[3] https://dyne.org/cjit/

[4] https://www.slashdot.org/~oliwer

[5] https://developers.slashdot.org/story/18/09/08/037245/creator-of-templeos-terry-davis-has-passed-away



My favourite (Score:4, Funny)

by flyingfsck ( 986395 )

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.

Re: (Score:3)

by ShanghaiBill ( 739463 )

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.

Re: My favourite (Score:2)

by Ronin Developer ( 67677 )

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

Re: (Score:3)

by ShanghaiBill ( 739463 )

> 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).

Re: (Score:2)

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.

Re: My favourite (Score:1)

by lufo ( 949075 )

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.

Re: (Score:2)

by ceoyoyo ( 59147 )

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

Re: (Score:2)

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.

Re: (Score:3)

by ShanghaiBill ( 739463 )

> all programming languages suck.

"There are only two kinds of languages: the ones people complain about and the ones nobody uses." -- Bjarne Stroustrup

Re:My favourite (Score:4, Funny)

by Entrope ( 68843 )

There are only 10 kinds of computer languages: those that write numbers in binary, those that don't, and those with off-by-one errors.

("there's two hard problems in computer science: we only have one joke and it's not funny." - [1]Phillip Bowden [x.com])

[1] https://x.com/pbowden/status/468855097879830528

Gimple c-terp anyone? (Score:1)

by davemc168 ( 998032 )

Seem to recall this product from the 80's, worked really well with better diagnostics than the c compilers of the era...

2MB? (Score:2)

by 93 Escort Wagon ( 326346 )

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:4, Informative)

by laughingskeptic ( 1004414 )

Herbert Schildt, "Building your own C interpreter", Dr. Dobb's Journal, 1989, Volume 14, Issue 8 pp. 38 - 49

Run/C from 1985 still works too. (Score:3)

by geekprime ( 969454 )

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

Show night or time may vary in your market.