Programming

JEP 457 Hello World Translator

March 16, 2024 - 14:22

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

January 21, 2024 - 11:01

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

October 5, 2023 - 17:45

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

January 9, 2023 - 17:47

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.

How To Build A Log4Shell Detector

February 3, 2022 - 21:25

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

October 21, 2021 - 07:12

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

May 8, 2019 - 00:00

As an exercise in using Scala's parser combinator library I implemented a Brainfuck interpreter - see my Github.

Advent of Code 2017

December 27, 2017 - 10:49

I used Advent of Code 2017 to try out a few different languages: Java, Lisp, Scala or Python.

Simple PHP Shopping Cart Tutorial

February 2, 2006 - 00:00

This is a very simple shopping cart that I wrote at university because many of my peers were asking for help with similar problems for assignments. It is incomplete and is not intended for use on a production website!

Subscribe to Programming
© 2024 Dr James Hamilton. All rights reserved.