The feature of being easier to write than assembly is often seen as the biggest advantage of high-level programming languages. The other benefit that comes with them is portability. With high-level languages, algorithms can be developed independently from the underlying hardware. This allows software to live on once the hardware becomes obsolete.
The compiler was a concept that was met with resistance when it was first introduced. This was at a time when computers were custom-built machines bearing individual names like ENIAC, UNIVAC and Mark I. A time when the global demand for computers was estimated to be around five units by the CEO of IBM. In this scenario, it took a visionary to foresee a future where the number of computers would outgrow the number of programmers and hardware would evolve so much faster than software that a compiler would make sense. One visionary was [Grace Hopper].
Continue reading “Disrupting The Computer Industry Before it Existed: Rear Admiral Grace Hopper”
There are many projects that call out for a custom language parser. If you need something standard, you can probably lift the code from someplace on the Internet. If you need something custom, you might consider reading [Federico Tomassetti’s] tutorial on using ANTLR to build a complete parser-based system. [Frederico] also expanded on this material for his book, but there’s still plenty to pick up from the eight blog posts.
His language, Sandy, is complex enough to be a good example, but not too complex to understand. In addition to the posts, you can find the code on GitHub.
Continue reading “Language Parsing with ANTLR”
We don’t use a GUI IDE, but if we did, it would most certainly be something along the lines of [Martin]’s embedded-IDE project. We’ve always felt that most IDEs are just fancy wrappers around all the tools that we use anyway: Makefiles,
ctags, and an editor. [Martin]’s project makes them less fancy, more transparent, and more customizable, while retaining the functionality. That’s the hacker’s way — putting together proven standard tools that already work.
The code editor he uses is QScintilla, which uses
clang for code completion. The “template” system for new projects? He uses
patch to import and export project templates. Because it uses standard tools all along the way, you can install the entire toolchain with
sudo apt-get install clang diffutils patch ctags make on an Ubuntu-like system. Whatever compiler you want to use is supported, naturally.
We can’t see a debugger interface, so maybe that’s something for the future? Anyway, if you want a minimalistic IDE, or one that exposes the inner workings of what it’s doing rather than hiding them, then give [Martin]’s IDE a try. If you want more bells and whistles that you’re not going to use anyway, and don’t mind a little bloat and obscuration, many of our writers swear by Eclipse, both for Arduino and for ARM platforms. We’ll stick to our butterflies.
Somewhat hidden among athletes, actors, and musicians, three giants of technology have been aptly named as 2016 Presidential Medal of Freedom recipients. Grace Hopper, Margaret Hamilton, and Richard Garwin all made significant contributions to the technology that envelops our lives and embody the quest for knowledge and life-long self learning that we’d like to see in everyone.
Rear Admiral Grace Hopper’s legacy lies with the origins of computer science. She wrote the first compiler. In a time when computers were seen more as calculating machines than easily adaptable frameworks she looked to the future and made it happen. She continued to make huge contributions with lasting effect in developing COBOL, unit testing methods for programmers, and in education. We have long loved her explanation of a nanosecond (and why software engineers shouldn’t waste cycles) and was one of the first to program on the Harvard Mark I which can still be seen in the lobby of the school’s engineering building.
As Director of Apollo Flight Computer Programming, Margaret Hamilton is the driving force behind the software of Apollo. When the program started, she was Director of Software Engineering at MIT Instrumentation Laboratory. Originally there wasn’t a plan or budget for software in the space program. Hamilton built the program and led the team who wrote the software and turned it into punch cards to be fed into the computer. We enjoyed reading about some of her adventures during the Apollo project, her drive to develop pristine code is palpable. Over the past year we’ve marveled at the rope memory of the Apollo Guidance Computer and delighted when a hardcopy of AGC software showed up at a party. Her legacy at having written the code for the first portable computer — one that happened to land on the moon and return home safely — is incredible.
Physicist Richard Garwin’s name is most associated with the first hydrogen bomb design. But another part of his work is more likely to have directly touched your life: his research into spin-echo magnetic resonance helped lead to the development of Magnetic Resonance Imaging. MRIs have of course become a fundamental tool in medicine. Garwin studied under Fermi during his doctoral work — you may remember Fermi from our look at the Fermiac analog computer last year.
Congratulations to these three recipients, their recognition is incredibly well deserved. We’d love to hear about some of your own technology heroes. Let us know on the tips line so that we may help celebrate their accomplishment and inspire the next generation of giants.
Any maker worth their bits will look for new ways to challenge themselves. [Robert Fotino], a computer science student at the University of California, is doing just that: designing and building his own lightweight hobbyist game console that he has appropriately named Consolite.
[Fotino] wrote his own compiler in C++ that converts from C-like languages to a custom-designed assembler that he has dubbed Consolite Assembly. To test his code, he also wrote an emulator before loading it onto the Mimas V2 FPGA board. Presently, Consolite uses 64KiB of main memory and 48 KiB of video memory; a future version will have 32 bit support to make better use of the Mimas’ 64 MiB of on board ram, but the current 16-bit version is a functional proof of concept.
An SD card functions as persistent storage for up to 256 programs, which can be accessed using the hardware switches on the Mimas, with plans to add user access in the form of saving game progress, storage outside of main memory, etc. — also in a future update that will include audio support.
As it stands, [Fotino] has written his own versions of Breakout, Tetris, and Tron to show off his project.
Not wanting for diligence, [Fotino] has provided thorough documentation of nearly every step along the way in his blog posts and on GitHub if you are looking for guidelines for any similar projects you might have on the back burner — like an even tinier game console.
Have you ever wanted to analyze or mutate some C or C++ code? You can do some simple pattern matching with regular expressions, but there’s always some special case or another that will break your logic. To do it right, you need to develop an entire parser, perhaps using a formal grammar and a tool like Yacc. That’s a big job, though, just to change all the floats to doubles.
[Adrian Sampson] wrote a blog entry to make you go from “mostly uninterested in compilers to excited to use LLVM to do great work.” LLVM – the Low Level Virtual Machine compiler infrastructure — provides tools for a lot of languages, including CLANG for C and C++. [Adrian] points out a few key differences between LLVM and other compilers and tools you might use for a similar purpose:
- LLVM uses a consistent intermediate representation that is human-readable
- It is extremely modular
- It is both highly hackable and an industrial-strength, well-supported compiler
He points out that compiler tools aren’t just for compiling. You can use them to analyze source code, build simulators, and inject code for security or testing, among other things (speaking of security testing, check out the use of LLVM to analyze binaries for security issues in the video after the break). The high hackability of LLVM is due to its modular nature. By default, a front end chews up the C or C++ code into the intermediate representation. Then multiple passes can modify the representation before handing it off for the next pass. The final pass does actual code generation for the target processor.
Continue reading “Hack your C++ with LLVM”
When we first heard about it a few weeks ago, we knew the ESP8266 UART to WiFi module was a special beast. It was cheap, gave every microcontroller the ability to connect to a WiFi network, and could – possibly – be programmed itself, turning this little module into a complete Internet of Things solution. The only thing preventing the last feature from being realized was the lack of compiler support. This has now changed. The officially unofficial ESP8266 community forums now has a working GCC for the ESP8266.
The ESP8266 most people are getting from China features a Tensilica Xtensa LX3 32-bit SOC clocked at 80 MHz. There’s an SPI flash on the board, containing a few dozen kilobytes of data. Most of this, of course, is the code to run the TCP/IP stack and manage the radio. There are a few k left over – and a few pins – for anyone to add some code and some extended functionality to this module. With the work on GCC for this module, it’ll be just a few days until someone manages to get the most basic project running on this module. By next week, someone will have a video of this module connected to a battery, with a web-enabled blinking LED.
Of course that’s not the only thing this module can do; at less than $5, it will only be a matter of time until sensors are wired in, code written, and a truly affordable IoT sensor platform is created.
If you have a few of these modules sitting around and you’d like to give the new compiler a go, the git is right here.