Showing posts with label compiled-languages. Show all posts
Showing posts with label compiled-languages. Show all posts

Sunday, April 15, 2018

compilerbook.org - Introduction to Compilers and Language Design by Prof. Douglas Thain

By Vasudev Ram

Came across this book today:

Introduction to Compilers and Language Design (compilerbook.org)

(a free online textbook by Douglas Thain)

Prof. Douglas Thain is Associate Professor, Computer Science and Engineering, University of Notre Dame, USA.

Excerpts from the page:

[ This online textbook is being released chapter-by-chapter during 2017. The complete book will be available for purchase in the spring 2018 semester.

This textbook is suitable for a one semester undergraduate course in compilers. Guided by this book, students can undertake construction of a compiler which accepts a C-like language and produces working X86 code. The textbook and materials have been developed by Prof. Douglas Thain as part of the CSE 40243 compilers class at the University of Notre Dame.

You are free to download, use, and print these PDFs for personal and academic use. Commercial printing or distribution is prohibited. Instead of copying PDFs, please point students to this page (compilerbook.org) so that they can access the latest version. If you enjoy holding a physical book (like I do!) you will be able to order an inexpensive hardcover edition in 2018. ]

I just read a bit of the book so far, but it seems quite good.

- Vasudev Ram - Online Python training and consulting

Get fast reliable hosting with A2Hosting.com

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Do you create and sell digital products? Get Convertkit:

Email marketing for online creators



Saturday, April 15, 2017

Andrei Alexandrescu's AMA on IAmA reddit (C++ and D are some topics)

By Vasudev Ram

Just saw this today via a link while browsing articles about DLang (the D Language):

Andrei Alexandrescu's AMA on IAmA reddit

It starts off like this:

[ I am a member of Facebook's HHVM team, a C++ and D pundit, and a Machine Learning guy. Ask me anything!

Background:
My name is Andrei Alexandrescu. I've been a Research Scientist at Facebook for almost four years, during which I've worked on various projects mainly around Machine Learning and systems programming. In January I joined the HHVM project, which aims at improving the productivity and performance of PHP on Facebook's server infrastructure.
I've also written a couple of books: Modern C++ Design, C++ Coding Standards (together with Herb Sutter), and The D Programming Language, as well as some papers and articles. Some of my talks are on video (this is the most recent).
Looking forward to answering your questions! ]

I read part of the thread (so far); there are some interesting questions and answers in it, about both C++ and D (and maybe some other stuff I haven't seen yet). One such interesting point was this, where, in reply to a question, he says he likes to brag about inventing D's scope statement :-)

Some excerpts below:

[
chefox 17 points 3 years ago
What's the biggest lesson learned from D that you wish other languages would apply?

andralex 36 points 3 years ago
The scope statement. It's rare that I enjoy bragging about something, but I do like to brag that I invented a new control flow statement (which is awesome because they're so few!).
I think many languages implement some form of deferred execution, but most miss the point - Lisp's with-open-file, Java's try/finally, Go's defer, C#'s using are all sorely wanting.
]

Another one:

[ ... We have had an incredible time with compile-time evaluation in D for years, and I'm glad C++ "stole" that idea. ... ]

Another:

[
miotatsu 29 points 3 years ago
what has been your happiest moment with programming?

andralex 54 points 3 years ago

I remember moments when I'd run a little program again and again with slightly different inputs just to revel in the joy of having done the proper incantations that make the machine do this and that and the other, like a clumsy but loyal genie. I mentioned I wrote this floppy disk formatter - it gave me a lot of joy to be able to tell it the complicated sequence of things I wanted to get done, to see how it ended up carving magnetized trenches into the physical world.

]

Comment about the floppy driver formatter:
[
My first application was a keyboard driver in assembler. It used only 782 bytes of memory as opposed to the default of 4KB. I wrote it because I only had little RAM available.
My second application was a floppy disk formatter written in C++. It formatted 5.25'' floppies to 1.6 MB. Floppies were expensive and I couldn't afford many. Of course, they didn't retain information very well, but long-term retention wasn't at the top of my list :o).
]

About functional programming:
[
amzeratul 11 points 3 years ago
Lots of functional programming features are now available in languages such as C++ and D - what do you think are some of the functional features that we'll see incorporated in languages such as those over the next decade or two?

andralex[S] 17 points 3 years ago
There's talk about purity in C++, but beyond that I'm not sure whether there are plans for major FP-related additions.
Of the usual suspects present in FP languages, D notably misses pattern matching. It is in tension with OOP-style (first match vs. best match), and I'm not sure whether or not it's a fundamental feature of functional style. There are no plans to add such at this time.
]

[
p0nce 9 points 3 years ago
How much more productive do you think D can really be if adopted at C++ scale? Me and other enthusiasts I know are heavily biased by our positive solo experiences with it.

andralex[S] 10 points 3 years ago
Productivity and its variations are difficult to measure. Build speeds alone, at one order of magnitude speedup, are dramatic enough to exert a change of paradigm. For example, many people say dynamic languages are productive because they have the "right" execution model - save file, hit Refresh. If actual times for a compiled language drop to the point of offering the same model, I think a whole category of perceptions would change.
One thing I noticed with D is its "plasticity". Once you have a body of code that works in C++, the natural tendency is to be conservative about changing it: unit testing is tenuous, subtle failure scenarios upon changes are legion, not to mention build times etc. In D, it's a lot easier to mold and remold designs are you go because you know you wont be penalized for it.
]

[
Ingrater 10 points 3 years ago
Following the developement of D you get the feeling that way to many developement resources are spend on new features instead of finishing existing ones. For example a lot of work has been put into user defined attributes while other features are unfinished, unstable or not even usable (alias this, shared, export, structs). Whats your opinion on this?

andralex[S] 14 points 3 years ago
I agree that we should focus more on completing, streamlining, and using what we've got. This is happening already - it's been a while since quality has been at the top of our list, and the positive PR has been visibly improving.
Now that we have more resources there is some amount of parallel work we could do, and the mixed blessing with volunteer work is people work on what they find interesting, not necessarily what's best to do at the moment. This has been a challenge, but at the same time a good problem to have.
]

[
jfernand 10 points 3 years ago
Andralex,
No question to ask, but the comment that I carry the D language book with me at all times, and re-read it like it is a novel; I love every line of code I write in D, and the language and its design choices make me a better programmer the more I understand them. D simply makes sense, and it is a shame that it does not have more traction... I am an seasoned C/C++/Perl programmer, and D is in many ways the epitome of the history of languages, in my opinion.

andralex[S] 9 points 3 years ago
Thank you! No worry, we'll figure out the traction issue :o).
]

There's a lot more to the thread, check it out. Here it is again:

Andrei Alexandrescu's AMA on IAmA reddit



- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Are you a blogger with some traffic? Get Convertkit:

Email marketing for professional bloggers



Saturday, April 8, 2017

The reference D compiler is now open source (dlang.org)

By Vasudev Ram


Just saw this discussion on HN:

DMD, the reference D compiler is now open source (dlang.org)

It is about this news about the D language:

dmd Backend converted to Boost License

I read part of the discussion, and also commented. As often happens, though the original post is about the change in the licensing of the back=end of the DMD compiler (Digital Mars D), the thread devolved (partly at least) into a discussion of the pros and cons of D versus some other languages, and that kind of thread is often interesting.

Updating the post to add:

- Link to this post on programming.reddit.com about the news:

The Official D Compiler Is Now Free (as in "freedom")

- As user bionsuba says there:

[ bionsuba[S] 30 points 4 hours ago
The front end as been Boost licensed for several years now. But now the backend has been relicensed thanks to Symantec giving their permission.
This has big implications for the language as a whole, as the compiler can now be included in Linux package managers. Meaning, D programs can be distributed on those same package managers. There's also the possibility that DMD can become part of the default packages on a distro! ]

And Andrei Alexandrescu (of Modern C++ Design fame), who now works with Walter Bright on the D language, adds:

[ andralex 16 points 3 hours ago
We will discuss more details and implications of the impact of open sourcing the compiler at DConf in Berlin in May. Registration is open! ]

Update 2 to add:

I'm putting below, an Ask HN thread that I had started some months ago. It got some interesting replies:

Ask HN: What are you using D (language) for?

The replies give some examples of non-trivial things that D can be used for.

Update 3 to add:

As Walter Bright say here, it's the #1 story on HN at the moment (and for a while now).

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Are you a blogger with some traffic? Get Convertkit:

Email marketing for professional bloggers