tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Regarding My first compiler


From: Jared Maddox
Subject: Re: [Tinycc-devel] Regarding My first compiler
Date: Sun, 12 Feb 2012 00:59:55 -0600

> Date: Sat, 11 Feb 2012 22:16:50 +0530
> From: RAHUL KUMAR <address@hidden>
> To: address@hidden
> Subject: Re: [Tinycc-devel] Regarding My first compiler
> Message-ID:
>       <address@hidden>
> Content-Type: text/plain; charset="iso-8859-1"
>


> Yes, i know to make own compiler is a very difficult and time intensive.
> But i don't want to make compiler with lot's of functionality, i want to
> make with a very basics functionality even you can say like "Hello world"
> or two add two integers etc.
>

Piece of advice from someone else working (among other projects) at
building a compiler: learn to use Bison and Flex. They aren't
necessarily enough (they won't be for me, at least with the way that
I'm currently writing the parser), but they do provide a good starting
point, since you don't have to put as much time into the lexer &
first-stage parser.

> Actually i want to do something at low level , like some micro controller
> and linux device drivers project by which i can explore my C at lower
> level. but as i don't know much about those thing, i thought that i have to
> start from this.
>

Have you considered a virtual machine & assembly language? There's all
sorts of interesting low-level stuff you can do in that field (for
example, why have I been using more C than C++ recently? So I can work
on a virtual machine that uses a file as it's memory! C++ gives you
enough tools that you can't safely use in that context that it slows
you down).

If the virtual machine was small enough, then you could even run it ON
microcontrollers.

Also, an assembler wouldn't necessarily be AS complex to write, as
long as you restricted it to 1 operation per line, with a fixed format
for the operations: thus, it could be a good introduction to Bison &
Flex.

If you decide afterwards that you wanted to run C on the virtual
machine, then you would be in a better position to write your own
compiler, or you could modify TCC to compile for it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]