background preloader

Let's Build a Compiler

Let's Build a Compiler
Related:  Prog

A successful Git branching model In this post I present the development model that I’ve introduced for some of my projects (both at work and private) about a year ago, and which has turned out to be very successful. I’ve been meaning to write about it for a while now, but I’ve never really found the time to do so thoroughly, until now. I won’t talk about any of the projects’ details, merely about the branching strategy and release management. Why git? For a thorough discussion on the pros and cons of Git compared to centralized source code control systems, see the web. But with Git, these actions are extremely cheap and simple, and they are considered one of the core parts of your daily workflow, really. As a consequence of its simplicity and repetitive nature, branching and merging are no longer something to be afraid of. Enough about the tools, let’s head onto the development model. Decentralized but centralized ¶ Each developer pulls and pushes to origin. The main branches ¶ masterdevelop Supporting branches ¶ develop

Interpreter pattern Uses for the Interpreter pattern[edit] Specialized database query languages such as SQL.Specialized computer languages which are often used to describe communication protocols.Most general-purpose computer languages actually incorporate several specialized languages. Structure[edit] Example[edit] The following Backus-Naur Form example illustrates the interpreter pattern. expression ::= plus | minus | variable | number plus ::= expression expression '+' minus ::= expression expression '-' variable ::= 'a' | 'b' | 'c' | ... | 'z' digit = '0' | '1' | ... | '9' number ::= digit | digit number defines a language which contains Reverse Polish Notation expressions like: a b + a b c + - a b + c a - - Following the interpreter pattern there is a class for each grammar rule. While the interpreter pattern does not address parsing[1]:247 a parser is provided for completeness. Finally evaluating the expression "w x z - +" with w = 5, x = 10, and z = 42. See also[edit] References[edit] External links[edit]

Tutorial: Metacompilers Part 1 James M. Bayfront Technologies, Inc. August 20, 2008 Tutorial in PDF Table of Contents Step 1. You are going to make a compiler right here on these web pages. Step 1.1 Background and History Programming languages above the level of individual machine assembly languages were introduced in the 1950s. Following IBM's FORTRAN in 1954 the first widely discussed academic language was ALGOL 60 from 1960. META II: A Syntax-Oriented Compiler Writing Language. Step 1.2 What's so special about META II? Why should anyone spend time learning something from 1964? You won't really find metacompilers like META II in compiler textbooks as they are primarily concerned with slaying the dragons of the 1960s using 1970s formal theory. I'm not alone as an admirer of META II. "Many details of those two days (February 4-5, 1967) still remain fresh in my mind. ... Step 1.3 The Metacompiler Workshop The Metacompiler Workshop is a webpage that can build compilers.

Introduction à la rétro-ingénierie de binaires Introduction Dans le domaine de l'informatique, et plus précisément celui de la programmation, nous développons et utilisons des programmes. Lorsque nous en écrivons le code source, nous avons généralement besoin de passer, parmi ces deux étapes, par l'une d'entre elles : Interpréter le code source à l'aide d'un programme appelé interprêteur ouCompiler le code source en langage machine pour que celui-ci soit compréhensible directement par notre processeur. Le point commun de ces deux actions est que l'on exécute, au final, du code binaire, celui directement "compris" par votre processeur. Les langages de programmation ont été créés pour se rapprocher davantage des dialectes de la langue humaine, parce que le binaire a une réputation d'être incompréhensible (la preuve, c'est une suite de 0 et de 1 !). On qualifie la rétroingénierie, dans le domaine informatique et plus précisément des binaires, par le processus de désassembler un programme afin d'en comprendre son véritable fonctionnement.

Simon Peyton Jones: book Simon Peyton Jones and David Lester. Published by Prentice Hall, 1992. Now, alas, out of print. However the full text of the book is available here: Abstract This book gives a practical approach to understanding implementations of non-strict functional languages using lazy graph reduction. The unusual aspect of the book is that it is meant to be executed as well as read. Overview of the book The principal content of the book is a series of implementations of a small functional language called the Core language. Appendix B contains a selection of Core-language programs for use as test programs thoughout the book. The main body of the book consists of four distinct implementations of the Core language. Chapter 2 describes the most direct implementation, based on template instantiation. The machine interpreter simulates the execution of the compiled program. One important way in which the Core language is restrictive is in its lack of local function definitions. Typographical errors

How Many Passes? - Fabulous Adventures In Coding Large bodies of code written in the C/C++ languages typically divide up the code into “header” files, which are just declarations of methods and types (and definitions of macros). The actual bodies of those methods and types are in completely different files. People sometimes ask me why doesn’t C# need header files? which is a bit of an odd way to phrase the question; I would have asked the equivalent question why does C++ need header files? Header files seem like a huge potential point of failure; all the time I edit C++ code and change the signature of a method; if I forget to update the header file, then the code doesn’t compile and often gives some cryptic error message. It buys the compiler writer one thing, and the user one thing. What it buys the user is that you can compile each individual “cpp” file into a “obj” file independently, provided that you have all the necessary headers. What it buys the compiler writer is that every file can be compiled in “one pass”. (Ah, memories.

Git Cheatsheet stash workspace index local repository upstream repository status Displays: <br>• paths that have differences between the index file and the current <code>HEAD</code> commit, <br>• paths that have differences between the workspace and the index file, and <br>• paths in the workspace that are not tracked by git. diff Displays the differences not added to the index. diff commit or branch View the changes you have in your workspace relative to the named <em>commit</em>. add file... or dir... Adds the current content of new or modified files to the index, thus staging that content for inclusion in the next commit. add -u Adds the current content of modified (NOT NEW) files to the index. rm file(s)... Remove a file from the workspace and the index. mv file(s)... Move file in the workspace and the index. commit -a -m 'msg' Commit all files changed since your last commit, except untracked files (ie. all files that are already listed in the index). checkout files(s)... or dir reset HEAD file(s)... reset --hard

Parsing Techniques - A Practical Guide Dick Grune and Ceriel J.H. Jacobs VU University Amsterdam, Amsterdam, The Netherlands Originally published by Ellis Horwood, Chichester, England, 1990; ISBN 0 13 651431 6 Description This 320-page book treats parsing in its own right, in greater depth than is found in most computer science and linguistics books. The book features a 48 page systematic bibliography containing over 400 entries. No advanced mathematical knowledge is required; the book is based on an intuitive and engineering-like understanding of the processes involved in parsing, rather than on the set manipulations used in practice. A short list of errata is available. Additional Keywords: information technology, user-interface design, compiler construction, natural language processing, pattern matching, artificial intelligence. About the authors Availability Present status of the book: New second edition ! A new, second, edition has been published, by Springer Verlag! [Dick Grune] [Ceriel Jacobs]

Make Your Own Programming Language, Part 0 This is the intro to a 5-part tutorial on how to implement a programming language. It is intended for people with some programming experience, who want to know how their compiler, interpreter or virtual machine works. Hint: it's not magic. This installment explains why you might want to make your own programming language, and why this tutorial is better than others. Note: here and there I'm going to reference advanced programming topics. Why your own programming language There are hundreds of programming languages out there, some of which have hundreds of dialects (BASIC...), so why would anyone bother to make another one? Reason one: It's fun! Remember the exhilarating feeling you had when you first made a computer follow your instructions? Reason two: It's useful While you may be perfectly happy with PHP or Java most of the time, there are tasks much better expressed in other, more specialized languages. Reason three: For better understanding What's so special about this tutorial P.S.

3D Tech News and Pixel Hacking -