Developers Club geek daily blog

Rust in 2016

1 year ago
2015 was considerable year for Rust: we released version 1.0, stabilized the majority of elements of language and a heap of libraries, considerably grew up as community, and also release 1.0), but it will be super-important year for Rust in which there will be many fascinating things. In this article I will tell that as I think, has to occur. It is not an official position and not the promise of the Rust developers.


Before we talk about the future, here several digits for last year:

In 2015 by forces of community Rust:

  • 331 suggestions for improvement of language (RFC) are created
    • from which 161 were accepted and poured in the main repository
    • only 120 people gave RFC, from them 6 people created 10 and more, Alex Crichton created 23 RFC
  • 559 tasks of improvement of RFC are created
  • It is sent and poured in a repository of Rust 4630 of Pull-requests
    • which authors are 831 persons, from them 91 created more than 10 requests, 446 people created only one, and Steve Klabnik was the author of 551 pull-requests
  • 4710 tasks are created
    • from which 1611 are still open
    • which authors are 1319 people from whom 79 created more than 10, and Alex Crichton opened only 159 tasks
  • Six stable releases of Rust (1.0 - 1.5) are let out
  • Stability of Rust – 96% of packets which were compiled on 1.0 is maintained, are still compiled with use of version 1.5

Read more »

As I wrote the compiler C in 40 days

1 year ago
I offer you transfer of the diary of Ruy Ueyam (Rui Ueyama), the programmer from Google which it conducted during operating time over implementation of the compiler of language C about three and a half years ago (but published only last December).
This diary does not bear any practical advantage and is not the tutorial, but it was very interesting to me to read it, I hope and this history will be pleasant to you too :)

I wrote the C compiler in 40 days which called 8cc. It is the diary written by me at that time. It is possible to look at a code and its history on GitHub.

Read more »

Results of the 2015th year for C ++

1 year ago
Perhaps, I will tell a banal thing, but last year was good year for With ++!

Just facts:
  • There was a Visual Studio of 2015 with excellent support of opportunities With ++ 14/17 and even several experimental things
  • There was long-awaited GCC 5.0
  • With ++ gained serious popularity. Somewhere since July — the third place in Tiobe Ranking
  • At the CppCon 2015 conference several important announcements were made

And now about this and another is a little more detailed

Read more »

Framework for procedural macroes in Rust

1 year ago

From the translator

Procedural macroes — one of the most expected Rust features. At the moment it is possible to write procedural macroes only under the unstable version of the compiler though there are several containers, like syntex, allowing to do a limited kodogeneration within the stable compiler. However it especially does not facilitate a situation as the interface to AST remains unstable, and though authors of syntex try to go in step with night assemblies, sometimes there are feyla because of changes in structure of AST.
In it the blog a post one of participants of core team — Nick Cameron — shared the vision of the future of procedural macroes. Though the post is complete of technical details on compiler interiors, it seemed to me that to a habrasoobshchestvo can be interesting to glance a little behind the scenes of development of Rust.

Framework for procedural macroes

In this post I will tell how, in my opinion, procedural macroes have to look. I already told about syntax in other post and when we publish API for procedural macroes, I will write a post and about it. I already described a number of changes in system of macroes so here I in something will repeat (partly contradicting last post), but I will disclose more details.

Read more »

We compile With \with ++ a code in WebAssembly

1 year ago
WebAssembly is a new binary format in which web applications can be compiled. It is projected and implemented directly while you read these lines and developers of all main browsers move it forward. Everything changes very quickly! We will show a current status of the project with rather deep immersion in tools on work with WebAssembly in this article.

In order that WebAssembly earned, we need two main components: the code assembly tooling in a binarnik of the WebAssembly format and the browsers capable this binarnik to load and execute. Both that, and another is not completely created and very strongly depends on completion of work on the WebAssembly specification, but in general it is separate components and their development goes in parallel. This separation — a good thing, it will allow compilers to create the WebAssembly-applications capable to work in any browser, and to browsers — to start WebAssembly-programs is not dependent on by what compiler they were created. In other words — we receive an open competition of building tools and browsers that all this will continuously move forward, bringing to the ultimate user the excellent choice. Besides, such separation allows design teams of tools and browsers to work in parallel and independently.

The new project on the party the WebAssembly tools about which I want to tell today is called Binaryen. Binaryen is the library for support of WebAssembly in compilers written on With ++. If you personally do not work on the compiler WebAssembly, then you probably do not need to know something about Binaryen directly. If you use some compiler WebAssembly, then it, perhaps, under a cowl uses Binaryen — we will review examples below.

Read more »

Intel® Tamper Protection Toolkit — the obfustsiruyushchy compiler and means of check of integrity of a code

1 year, 1 month ago

Quite recently the Intel company let out very interesting tool kit for software developers allowing to add protection of a program code against cracking and it is essential to complicate life to hackers of programs. This set includes the obfustsiruyushchy compiler, means for creation of the file of the signature used for check of integrity of the loaded dynamic libraries and also library of functions of check of integrity and additional useful tools. Intel Tamper Protection Toolkit beta can be downloaded absolutely free of charge on the website Intel.

Read more »

Development of the parser, kodogenerator and the SQL editor by means of EMFText

1 year, 1 month ago

It is the 6th article of a cycle on the development managed by models. In last article you gained general idea about development of domain-specific languages by means of EMFText. Time to pass from toy language to more serious came. There will be many drawings, a code and the text. If you are going to use EMFText or the similar tool, then this article has to save to you a lot of time. Perhaps, you learn something new about EMF (delegates of conversions).

Like the brave hobbit we will begin the way with BNF grammar of SQL, we will reach a terrible dragon (metamodel) and we will return back to grammar, but already another …

Read more »

Get acquainted, loop fracking

1 year, 1 month ago
The purpose of this work is designation of one more technology of optimization of cycles.
At the same time there is no task to be guided by any existing architecture, and, on the contrary
let's try to act whenever possible abstractly, relying mainly on common sense.

The author called this equipment "loops fracking" by analogy with, for example, "loops unrolling"
or "loops nesting". Especially as the term reflects sense and is not occupied.

Read more »

The lightweight designer of parsers with an interactive mode

1 year, 1 month ago
Periodically facing small problems on development of unpretentious analyzers of the text, solved this problem to automate and the academic interest haunted. Originally looked towards Racc (one of interpretations of Yacc), but it seemed me rather not a simple solution for my small tasks and then I decided to develop the unpretentious analyzer. Though, of course, if you develop the compiler or something similar and still commercially, then definitely you should look towards Racc.

But if you want to understand what is the parser and as fast to write it most, at the same time without reading a lot of articles about lexical analyzers like book of a dragon, then forward under kat (though the book very good).

Read more »

Half a century to "universal machine languages" (1966 — 2016): last, this, future

1 year, 2 months ago


The narration can be begun since 1962 when at the Cambridge university work on CPL ("Cambridge Programming Language") — "improved version" ALGOL-60 began. The graduate student Martin Richards was connected to work on language; in implementation of new YaP need of manual porting of the compiler for different computer platforms seemed it the main complexity. In particular, when the Cambridge EDSAC-2 was replaced with Atlas-2, the CPL developers spent a lot of time for porting of the compiler for a new platform.

Martin's thesis was devoted "to CPL which is most compiled": the compiler developed by Martin was written on strongly simplified CPL option which compiler was simple to be written on the macroassembler of that time. Transfer of CPL on a new platform could be executed in two steps now:
  1. Manually we write the compiler of "the simplified CPL";
  2. We compile it the compiler of "complete CPL".

On it Martin did not stop, and developed BCPL — system for development of transferable compilers. The compiler BCPL generated the pseudo-code named by Martin "OCODE".
OCODE looked approximately so:
OCODE "interpretation" ("procode")
94 5 L1 83 73 69 86 69
95 4
42 0
42 0 40 2 14
42 0 42 1 40 2 14 83
42 2
40 3 42 1 15
85 L5
90 L6
42 1 40 4 40 2 14 83
40 4 42 1 14 80 4 
90 5 40 4 40 5 88 L6
91 4
42 2 40 3 42 1 15 92
85 L7
90 L8 40 4 40 2 14
8 87 L9
40 4 42 2 11 92
85 L11
90 L10
42 0 40 6 40 2 14 83
40 4 40 6 14 80 6
90 L11
40 6 40 3 22 86 L10
91 6 90 L9
40 4 42 1 14 80 4
90 L7 40 4 40 5 88 L8
91 4 97 103 0
ENTRY 5 L1  'S' 'I' 'E' 'V' 'E'
LN 0
LN 2
LP 6 LP 3 LS JT L10
; procedure heading
; stack frame (two parameters and two local variables)
; to place number 0 on a stack
; to place one more 0, to add to it the 2nd element of a stack
; to write in an array at stack top value under it
; the same for the 1st array cell
; to place number 2 on a stack
; to subtract unit from value of the 3rd element of a stack
; to write result in local variable
; to pass to L5 tag
; declaration of a tag of L6
; to take the 4th element of a stack, to write in an array on this index 1
; to add to the 4th element of a stack 1, to write result back
; L5: to pass to L6 tag if the 4th element of a stack <= to the 5th
; the declaration that on a stack now four elements
; to subtract unit from value of the 3rd element of a stack
; to pass to L7 tag
; L8: to put the 4th and 2nd elements of a stack
; to read value to this address; if it is 0, to pass to L9
; to increase the 4th element by two
; to pass to L11 tag
; declaration of a tag of L10
; to take the 6th element of a stack, to write in an array on this index 0
; to add the 4th to the 6th element of a stack, to write the machine cut t back
; declaration of a tag of L11
; to pass to L10 tag if the 7th element of a stack is less than 4th
; on a stack now six elements; declaration of a tag of L9
; to add to the 4th element of a stack 1, to write result back
; L10: to pass to L8 if the 4th element of a stack <= to the 5th
; on a stack four elements; end of procedure
(For economy of the place, sequence of commands are written in one line. Martin in the guide to BCPL arrives in the same way.)

The source code on BCPL:
LET sieve(workvec, vecsize) BE
  workvec!0 := 0
  workvec!1 := 0
  FOR i = 2 TO vecsize-1 DO workvec!i := 1
  FOR i = 2 TO vecsize-1 DO
    IF workvec!i DO
    { LET j = 2 * i
      WHILE j < vecsize DO
      { workvec!j := 0
        j := j + i
In newer OCODE versions support of floating-point numbers (respectively, the set of the supported opkod almost doubled) was added, and also deleted opkod ENDFOR — instead of it couple is generated LE JT.

Among "universal machine languages" OCODE is unique the fact that tags in it are defined by special instructions — i.e. for interpretation of its program it is necessary to load at first all into memory and to find in it tags.
— and the separate program, a kodogenerator, turned the file with such pseudo-code into the feasible program for the final processor. OCODE remained in the form of the text file from the decimal numbers separated by spaces and transfers of lines: when OCODE was developed, the file format binding to the specific size of byte would limit portability of such file.

The compiler BCPL(1) was delivered in the form of OCODE and to transfer it to a new platform, it was necessary:
  1. To manually write the interpreter of a pseudo-code (2) (in any language though on the BASIC);
  2. To adapt a kodogenerator, (3) written on BCPL, for the platform;
  3. To start the compiler BCPL (1) under the interpreter (2), to feed to it a kodogenerator (3) and to receive on an output an executable file of a kodogenerator (4);
    • The interpreter (2) from this point is not necessary to us any more.
  4. To banish a pseudo-code of the compiler (1) through a kodogenerator (4) and to receive an executable file of the compiler on an output.

Such approach meant that transfer of the compiler on a new platform requires only the minimum of low-level programming; and it is valid, implementation of BCPL was complete by 1967 — earlier, than the implementation of CPL begun for several years earlier was complete!

BCPL advantages in relation to system programming inspired Ken Thompson on creation of language of Bee, and that is the colleague Ken, Dennis Ritchi, on Xi's creation. From BCPL the tradition went to designate {curly brackets} program blocks, and on wasit is writtenBCPL the first program "Hello, World!".
GET "libhdr"

LET start() = VALOF
{ writef("Hello*n")
More important to us the reason for which BCPL became history: OCODE — the first universal "architecture of command set" (ISA), i.e. the "virtual computer" which is not attached to any specific hardware platform with its features. BCPL, thus — the first programming language corresponding to a paradigm "Write once, run anywhere" (WORA): the program to BCPL can be distributed in the compiled type, and it can be started on any platform for which there is OCODE-kodogenerator.

Read more »