December 09, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert M. Münch | On Tuesday, 9 December 2014 at 10:54:22 UTC, Robert M. Münch wrote: > On 2014-12-09 00:45:41 +0000, deadalnix said: > >> On Monday, 8 December 2014 at 15:44:55 UTC, Stefan Koch wrote: > Any link? I tried to google it but it's such a generic word etc. no luck. http://linux.die.net/man/1/cat It was a joke. Could also say "notepad" on Windows. |
December 09, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert M. Münch | On Tuesday, 9 December 2014 at 10:55:24 UTC, Robert M. Münch wrote:
> On 2014-12-07 19:13:41 +0000, Stefan Koch said:
>
>> I'd like to announce that I am going to be writing a C-compiler in D.
>> Without flex or bison or anything like that.
>> Just pure handwritten D.
>
> Hi, how about using PEG for parsing etc.? IMO that would be a very good showcase for the power of PEG And D.
>
> --
> Robert M. Münch
> http://www.saphirion.com
> smarter | better | faster
I will use a handwritten recursive decent parser.
Since that is what I deem the easiest thing to do.
|
December 09, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert M. Münch | On Tuesday, 9 December 2014 at 10:54:22 UTC, Robert M. Münch wrote: > On 2014-12-09 00:45:41 +0000, deadalnix said: > >> On Monday, 8 December 2014 at 15:44:55 UTC, Stefan Koch wrote: >>> I want to do a C backend first. >>> Building an LLVM Backand out of that is a small step. >> >> There is already a very popular C to C compiler out there. It is >> called cat, and come out of the box with any UNIX like system. > > Any link? I tried to google it but it's such a generic word etc. no luck. > > -- > Robert M. Münch > http://www.saphirion.com > smarter | better | faster That was a joke. http://unixhelp.ed.ac.uk/CGI/man-cgi?cat |
December 10, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | >
> I will use a handwritten recursive decent parser.
> Since that is what I deem the easiest thing to do.
Take a look at the std.lexer proposal first.
|
December 10, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tobias Pankrath | On Wednesday, 10 December 2014 at 13:02:43 UTC, Tobias Pankrath wrote:
>>
>> I will use a handwritten recursive decent parser.
>> Since that is what I deem the easiest thing to do.
>
> Take a look at the std.lexer proposal first.
Thanks for your suggestion.
In fact, I know and like std.lexer.
But this is an educational project to showcase compiler construction. So everything will be written from scratch.
|
December 11, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 09/12/14 02:45, deadalnix wrote:
> On Monday, 8 December 2014 at 15:44:55 UTC, Stefan Koch wrote:
>> I want to do a C backend first.
>> Building an LLVM Backand out of that is a small step.
>
> There is already a very popular C to C compiler out there. It is
> called cat, and come out of the box with any UNIX like system.
I know it was meant as a joke, but I couldn't resist nitpicking.
When Stroustrup started out with an OO successor to C, he wrote a preprocessor that would convert his new syntax to C, to be passed to a C compiler. When the language started to evolve, that proved insufficient, and he wrote CFront, a C++ to C compiler.
He defines the difference between a preprocessor and a compiler along these lines: With a compiler, any and all compilation errors need to be caught by the front end. If the front end accepted your program, and the back end fails to compile it, it is, by definition, a compiler bug.
As such, cat (nor its close neighbor, "tac | tac"), are not a compiler, since it does not catch compilation errors.
Sorry for the nitpick.
Shachar
|
December 11, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Wednesday, 10 December 2014 at 17:19:28 UTC, Stefan Koch wrote:
> On Wednesday, 10 December 2014 at 13:02:43 UTC, Tobias Pankrath wrote:
>>>
>>> I will use a handwritten recursive decent parser.
>>> Since that is what I deem the easiest thing to do.
>>
>> Take a look at the std.lexer proposal first.
>
> Thanks for your suggestion.
> In fact, I know and like std.lexer.
>
> But this is an educational project to showcase compiler construction. So everything will be written from scratch.
I didn't want to suggest to use std.lexer, but to showcase the nice compile time tricks it employs, e.g. the generation of a Trie at compile time.
|
December 11, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to eles | On 2014-12-09 11:15:19 +0000, eles said: > On Tuesday, 9 December 2014 at 10:54:22 UTC, Robert M. Münch wrote: >> On 2014-12-09 00:45:41 +0000, deadalnix said: >> >>> On Monday, 8 December 2014 at 15:44:55 UTC, Stefan Koch wrote: > >> Any link? I tried to google it but it's such a generic word etc. no luck. > > http://linux.die.net/man/1/cat > > It was a joke. Could also say "notepad" on Windows. :-) At least one you catched... I was wondering... but you know, there are so many strange names etc. used... who knows. Better to check. -- Robert M. Münch http://www.saphirion.com smarter | better | faster |
December 11, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tobias Pankrath | On Thursday, 11 December 2014 at 15:02:02 UTC, Tobias Pankrath wrote:
>
> I didn't want to suggest to use std.lexer, but to showcase the nice compile time tricks it employs, e.g. the generation of a Trie at compile time.
std.lexer is awesome, no doubt about it!
But it is not in the scope of building a dead simple compiler.
I am still about a way to simplify parsing.
It is still not dead simple :(
|
December 11, 2014 Re: [OT?] C compiler written form scratch in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | I will start uploading official videos at Monday. If you are interested in qcc please join me in irc. server : irc.freenode.net channel : #qcc |
Copyright © 1999-2021 by the D Language Foundation