Programming
LLVM Hello World
Writing a “Hello World” program is often a rite of passage for a software engineer when learning a new language.
JEP 457 Hello World Translator
If you're new to Java class files and Java bytecode check out JEP 457 Hello World which is an introduction to the topic.
Often, when you start to learn a new language you'll write a "Hello World" application as a first step. In this post, as a first step to transforming Java class files, we'll write a "Hello World" translator.
We'll see how, in just a few lines of code using the JEP 457 Java Class-File API, we can create an application that can apply a code transformation to automatically translate "Hello World" to some other language such as "Hallo Wereld".
Build A Compiler With The JEP 457 Class-File API
This is an updated version of the Java Advent 2023 article "My First Compiler" using the JEP 457 Class-File API instead of ProGuardCORE for class file generation.
As a Java developer you probably spend a lot of time writing Java source code and executing a Java compiler to convert that human readable Java source into machine readable bytecode stored in Java class files.
If you've ever wondered how a compiler works or how a Java compiler creates Java class files, then keep reading! We'll work through writing a compiler for a simple programming language that compiles to Java bytecode.
We'll implement a compiler for the esoteric programming language Brainf*ck, which is simple enough that it doesn’t require much code to create a working compiler.
JEP 457 Hello World
This is an updated version of the Java Advent 2022 "JVM Hello World" using the JEP 457 Class-File API.
Writing a “Hello World” program is often a rite of passage for a software engineer when learning a new language.
If you’re a Java developer, you might even remember the first time you typed public static void main(String[] args) in your editor of choice. But did you ever wonder what’s inside that “.class” file that the compiler spits out? Let’s look at how we can write a JVM “Hello World” by creating a class file programmatically.
We’ll work through creating a class file for the following simple Java Hello World application.
JVM Hello World
Writing a “Hello World” program is often a rite of passage for a software engineer when learning a new language.
If you’re a Java developer, you might even remember the first time you typed public static void main(String[] args) in your editor of choice. But did you ever wonder what’s inside that “.class” file that the compiler spits out? Let’s look at how we can write a JVM “Hello World” by creating a class file programmatically.
We’ll work through creating a class file for the following simple Java Hello World application.
Keep Rules in the Age of Kotlin
Kotlin is relatively young – only 11 years old – and Android has only had official support for Kotlin for five years. Yet Kotlin is now the go-to language for Android development, and is becoming more popular for desktop and server application development. Kotlin is used by over 60% of Android professional Android developers and it's estimated that 1 million professional software developers use Kotlin as 1 of their 3 primary languages.
Clearly, we are truly in a new age: the Age of Kotlin.
Head over to my latest Guardsquare blogpost to find out why, in the Age of Kotlin, writing ProGuard keep rules requires thinking in terms of Java.
How To Build A Log4Shell Detector
Log4Shell (CVE-2021-44228) is a zero-day vulnerability in Log4J, a popular open-source Java logging framework used by many organizations around the world. Though the vulnerability has been patched, and upgrading to a newer Log4J version solves the problem, not everyone has completed the necessary upgrade.
I've written a Guardsquare blog post showing how you can be build a Log4Shell detector using ProGuardCORE to determine if applications are using an older Log4J version that is susceptible to the vulnerability.
Klox: A Kotlin implementation of lox with a JVM backend built using ProGuardCORE
A Kotlin implementation of lox, the language from Crafting Interpreters, with a JVM backend built with ProGuardCORE.
The klox language is a superset of lox and includes features not implemented in the Crafting Interpreters lox implementation.
Brainf*ck Interpreter
As an exercise in using Scala's parser combinator library I implemented a Brainfuck interpreter - see my Github.
Advent of Code 2017
I used Advent of Code 2017 to try out a few different languages: Java, Lisp, Scala or Python.