newprint•

Call me stupid, but can someone give a link where I can post the question ?

1
ericlippert•

I'll post the topic for questions on Friday morning, Pacific time, and start answering questions at 1PM Pacific time.

3
AboutHelpTools3•

I cant even imagine what goes into coding a compiler. I'm only a desktop application dev, and in my mind the three most complex things to program are compilers, operating systems, and web browsers.

Microsoft does great at all three. I will be staying tuned for his AMA.

-1†
[deleted]•

[deleted]

13
munificent•

Google and Apple too.

5
[deleted]•

[deleted]

1
jeandem•

You could make your own toy compiler and find out. It's just another program, which you can make as simple or as advanced as you'd like.

EDIT: Someone else seems to agree with me.

10
Pet_Ant•

I recommend starting with Brainfuck since its so simple. It's the "hello world" of compilers.

3
blake_loring•

You should definitely try and build your own parser and interpreter. It's not difficult to implement a simple language and it will give you a lot of insight into what the compiler is actually doing to your code (helps a lot when debugging or trying to understand awful compiler error messages). Plus its an incredibly fun/rewarding exercise.

2
DuoThree•

Any suggestions as to where to start? I haven't taken any compiler classes yet but this sounds like a fun project.

1
blake_loring•

Sure. I spend (probably too much) of my free time screwing around with parsers.

Essentially, under the hood most parsers boil down to a lexical analyzer which turns blocks of text into an enum (For example abc45 would be marked as an ID, wheras 51241 would be identified as an integer) and some algorithm which is capable of taking sequences of enums and inferring meaning from them.

The lexical analyzer (tokeniser) generally uses strcmp and regular expressions, plus some basic rules like white space means the end of a identifier, to work out what it's looking at.

I've got what I think is a relatively simple example of a basic tokeniser here.

https://github.com/mmjack/LJIT/blob/master/src/tokens.h https://github.com/mmjack/LJIT/blob/master/src/tokens.cpp

I would recommend first looking at LL(0) and LL(1) parsers as they are incredibly easy to implement (You don't need to build jump tables, it all looks like normal code).

Here's an example of a basic LL parser I use to parse this rubbishy lispy thing https://github.com/mmjack/LJIT/blob/master/examples/test.ljit https://github.com/mmjack/LJIT/blob/master/src/parser.cpp

2
dtlv5813•

C# is in my opinion the best product MS ever built. I have been less than impressed with their OS and web browsers. But then I switched to Ubuntu and then Mac a few years ago so perhaps they have gotten better since...

0
[deleted]•

[deleted]

-17
Matthew94•

it's compiler

Maybe you shouldn't be making comments before you understand grammar.

OHHHHHHHHHHHH SHIT

13
timsk951•

Error: Unable to parse "BurnException"

1
immibis•

What do you write?

1
Ishmael_Vegeta•

I cant even imagine what goes into coding a compiler. I'm only a desktop application dev

typical

-19
google_you•

Is that the same guy?

-2
[deleted]•

[deleted]

-12
wookin_pa_nub2•

It's not JAVA, and it's not GITHUB. It's Java and GitHub.

5
Godd2•

Feeding trolls makes them stronger.

1
wookin_pa_nub2•

Good point. I should have checked his comment history before bothering.

1
[deleted]•

[deleted]

-2
cholantesh•

So everyone gives at least one fuck?

0
nice_day_and_night•

I predict a douche will ask the following "question":

durr hurr derp what do you think of Rust

Gotta have a douche plugging Rust whatever the topic, however tenuous the relevance.

-30
[deleted]•

[deleted]

16
zenflux•

Delicious irony.
^^Ha, ^^irony!

8
danielkza•

however tenuous the relevance

How is asking one of the designers of a very popular language about another language not relevant?

5
google_you•

And? You just saved a bunch of money on car insurance by switching to mongodb, because mongodb is web scale in the cloud. And C# is fully compatible with mongodb even without LINQ cause impedance mismatch between datalog and operational computation model is eliminated with mongodb.

-59
rjbwork•

wat

7