Some language not implemented in C?

N

neoedmund

I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?
 
N

neoedmund

I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?

other than "asm" and "cpu hex code"
 
U

user923005

I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?

Languages can be implemented in any language.
For instance, you can get the Gold Parser Generator, get a Gold
grammar, and then generate the language parser in any supported
language:
ANSI C
Assembly - Intel x86
C#
C++
D
Delphi
Java
Pascal
Python
Visual Basic
Visual Basic .NET
All .NET languages
All ActiveX languages

So the burning question is:
Why is C used a lot to build compilers?
The answer is because C is pretty much a portable assembler (some
might call it 'PASM' but that would probably just generate command
line driven trash). Anyway, since optimizing C compilers tend to
generate snazzy assembly language for lots and lots of target systems,
it is a natural choice. However, to answer your original question, I
have used a Pascal compiler that was written in Pascal. Sounds
recursive, but it's not. C compilers are usually written in C also.
 
C

Chris Dollin

neoedmund said:
I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?

Pop11, Prolog, Standard ML, and Common Lisp all have not-implemented-in-C
implementations.

Many SmallTalks.

BBC Basic.

Algol W.

Algol 68.
 
M

mark.bluemel

I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?

How about Java?

A Java Virtual Machine - the thing that interprets compiled Java
bytecode - does not need to be implemented in C, and there are
implementations which are not written in C. See (e.g.) http://jikesrvm.org/

Java compilers - which read Java language source and generate bytecode
- are commonly written in Java. One exception is the jikes java
compiler which is implemented in C++.
 
B

Bartc

neoedmund said:
I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?

What do you have against C?
 
M

Mark Wooding

neoedmund said:
I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?

Many compilers are written in the language they compile. Many Lisp and
Scheme implementations are like this, as is the Glasgow Haskell
Compiler, Standard ML of New Jersey, and so on. I'm pretty sure Sun's
Java compiler is written in Java too.

C tends to get used to write the runtime systems for these languages --
providing garbage collection and other low-level services -- because
it's more portable than assembler and still low-level enough to do the
job. There are exceptions, however.

For example, the entire runtime system for the famous T compiler (a
highly optimizing native-code compiler for a dialect of Scheme) was
itself written in T -- including the garbage collector, which was
carefully constructed using deep knowledge of the compiler's behaviour
so as not to allocate any objects on the heap while it was running.

The Armed Bear Common Lisp system is implemented in a mixture of Java
and Lisp; most of the runtime system is written in Java, including the
interpreter, but the compiler (targetting JVM bytecodes) is written in
Lisp, as is much of the library.

The Squeak Smalltalk system is entirely written in Smalltalk, including
the runtime system. The runtime is actually written using a subset of
Smalltalk which is, I believe, compiled into C and thence to native
code. But there's no reason in principle why it couldn't be compiled
directly to assembler or native code.

-- [mdw]
 
G

Gene

I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?

The GNAT Ada compiler is implemented in Ada. (There is a bit of C to
connect libraries and runtime support.)
 
R

robertwessel2

Many compilers are written in the language they compile.  Many Lisp and
Scheme implementations are like this, as is the Glasgow Haskell
Compiler, Standard ML of New Jersey, and so on.  I'm pretty sure Sun's
Java compiler is written in Java too.


I'm not sure exactly how you meant "many," but only a very small
fraction of compilers in existence are self-hosted, although that's
not an inconsequential total number, and they're highly represented in
the set of compilers people commonly use. The vast majority are for
small languages that are utterly unsuited to hosting a compiler. And
even for many languages that nominally implement the same language
they're written in, they cannot self host because the target platform
is utterly incapable of running that big a program.

But to the OP: I've also seen Cobol, Basic and Fortran compilers
written in their respective languages, not that I'd really recommend
any of those languages for compiler writing.

A compiler is a fairly ordinary program, and should be written in a
language that makes it easy to write, deploy, support, etc.
 
S

Sjouke Burry

neoedmund said:
I found most other languages are implemented in C, such as Java,
Python, etc...
could you give me something not?
English,Latin,...............etc
 
D

Dik T. Winter

>
> The GNAT Ada compiler is implemented in Ada. (There is a bit of C to
> connect libraries and runtime support.)

The CDC Algol 68 compiler was implemented in SIMPL. But I know of an
Algol 60 compiler implemented in C. Strange, as C postdates Algol 60
by quite a bit ;-).

I know for sure that Python was implemented in C because that was at that
time about the only compiler available on the machines on which Python was
first implemented. Doing the same thing in Fortran would have been insane.
But if Guido reads this he probably can give particulars ;-). (I disremember
on which machine actually the first version of Python was developed, but it
must have been not much more than 100 meters from my workplace.)

It is only because C is as a programming language so widely available.
 
S

Stefan Ram

Marek Kubica said:
the Java compiler is written in Java.

This might be true. On a web page, someone claims that the
JVM was written in C:

»The core of the JVM is written in C«

http://x86.sun.com/thread.jspa?threadID=5343144&messageID=10482888

Parts of the JVM might be written in Java, but I find:

..\j2se\src\share\back\ArrayReferenceImpl.c
..\j2se\src\share\back\ArrayTypeImpl.c
..\j2se\src\share\back\bag.c
..\j2se\src\share\back\ClassLoaderReferenceImpl.c
..\j2se\src\share\back\ClassObjectReferenceImpl.c
..\j2se\src\share\back\classTrack.c
..\j2se\src\share\back\ClassTypeImpl.c
..\j2se\src\share\back\commonRef.c
..\j2se\src\share\back\debugDispatch.c
..\j2se\src\share\back\debugInit.c
..\j2se\src\share\back\debugLoop.c
..\j2se\src\share\back\error_messages.c
..\j2se\src\share\back\eventFilter.c
..\j2se\src\share\back\eventHandler.c
..\j2se\src\share\back\eventHelper.c
..\j2se\src\share\back\EventRequestImpl.c
..\j2se\src\share\back\FieldImpl.c
..\j2se\src\share\back\FrameID.c
..\j2se\src\share\back\inStream.c
..\j2se\src\share\back\invoker.c
..\j2se\src\share\back\log_messages.c
..\j2se\src\share\back\MethodImpl.c
..\j2se\src\share\back\ObjectReferenceImpl.c
..\j2se\src\share\back\outStream.c
..\j2se\src\share\back\ReferenceTypeImpl.c
..\j2se\src\share\back\SDE.c
..\j2se\src\share\back\StackFrameImpl.c
..\j2se\src\share\back\standardHandlers.c
..\j2se\src\share\back\stepControl.c
..\j2se\src\share\back\stream.c
..\j2se\src\share\back\StringReferenceImpl.c
..\j2se\src\share\back\threadControl.c
..\j2se\src\share\back\ThreadGroupReferenceImpl.c
..\j2se\src\share\back\ThreadReferenceImpl.c
..\j2se\src\share\back\transport.c
..\j2se\src\share\back\util.c
..\j2se\src\share\back\VirtualMachineImpl.c

Also, parts of the J2SE standard library are written in C.

»Here's the thing: C is everywhere. Recently Tim Bray made
basically the same point; all the major operating systems,
all the high-level language runtimes, all the databases,
and all major productivity applications are written in C.«

http://girtby.net/archives/2008/08/23/in-defence-of-c/

»=head2 What language is Parrot written in?

C.

=head2 For the love of God, man, why?!?!?!?

Because it's the best we've got.«

http://search.cpan.org/src/SFINK/parrot-0.0.11.2/docs/faq.pod

»C overwhelmingly proved the most popular programming
language for thousands of new open-source projects in
2008, according to license tracker Black Duck Software.

The company, which monitors 180,000 projects on nearly
4,000 sites, said almost half - 47 per cent - of new
projects last year used C. Black Duck said 17,000 new
open-source projects were created in total. Next in
popularity after C came Java, with 28 per cent.«

http://www.theregister.co.uk/2009/01/21/open_source_projects_08/

Regarding the last quote: I am afraid that they have added the
numbers for C, C++ and C# together and are referring to this
as »C«.
 
R

Richard Bos

The CDC Algol 68 compiler was implemented in SIMPL. But I know of an
Algol 60 compiler implemented in C.
I know for sure that Python was implemented in C
It is only because C is as a programming language so widely available.

That's probably one of the main reasons, but I would be surprised if a
perception of C as an efficient language is also an argument, in many
cases. (I don't claim that the argument is correct, nor that it is
wrong; merely that it is made.)

Richard
 
D

Dik T. Winter

>
> That's probably one of the main reasons, but I would be surprised if a
> perception of C as an efficient language is also an argument, in many
> cases. (I don't claim that the argument is correct, nor that it is
> wrong; merely that it is made.)

It is made indeed, and is (or at least was) wrong on a number of systems.
I know for sure that Python was implemented in C because the precursors
of it (B and ABC) and the first versions were implemented on machines where
C was the only viable compiler. If these were developed on the CDC we were
also using, C would certainly *not* have been the first implementation
language. Efficiency was certainly *not* a reason.

On the CDC systems Algol 68 was written in SIMPL, not in Pascal (the most
efficient language), nor in Fortran (the next efficient language). One of
the reasons here was that SIMPL (*) was the most suitable language to do it
in.
 
R

Richard Bos

Dik T. Winter said:
It is made indeed, and is (or at least was) wrong on a number of systems.

Of course it is often wrong. Nevertheless, it is often used as an
argument to write said:
I know for sure that Python was implemented in C because the precursors
of it (B and ABC)

*Brrrrr*

I have an MS-DOS implementation of that. It is _creatively_ ghodahwful.
On the CDC systems Algol 68 was written in SIMPL, not in Pascal (the most
efficient language), nor in Fortran (the next efficient language). One of
the reasons here was that SIMPL (*) was the most suitable language to do it
in.

Are you sure that that history, and the issuant emotions, were not of
some influence in the decision of what was "suitable"?

Richard
 
D

Dik T. Winter

>
> Are you sure that that history, and the issuant emotions, were not of
> some influence in the decision of what was "suitable"?

I am quite sure of it, for some reasons. Many CDC compilers were implemented
in SIMPL, which ultimately was nothing more than a glorified assembler. One
of those was the Fortran compiler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top