Skip to content

Instantly share code, notes, and snippets.

@Reedbeta
Last active June 28, 2023 08:51
Show Gist options
  • Save Reedbeta/2b4ce080ab5323de6976 to your computer and use it in GitHub Desktop.
Save Reedbeta/2b4ce080ab5323de6976 to your computer and use it in GitHub Desktop.

Programming Language Evaluation

A list of simple tasks to perform when learning or evaluating a new language. Each of these should be able to be completed in a few hours, and will help to get the feel of the language and its standard libraries. A well-rounded set of evaluation tasks will help ensure all parts of the language are exercised. You might also write some tests to demonstrate implementation correctness.

Basics

  1. Hello world
  2. Read lines from a text file and output them in sorted order
  3. Read numbers from a text file and output the mean and standard deviation
  4. Given an amount of money and a list of coin denominations provided on the command line, output all the possible ways to make change
  5. Port a random number generator such as Mersenne Twister

General

  1. Parse configuration files in a simple text format such as .ini and build a key-value store
  2. Simple regex matcher
  3. Port a compression lib such as LZ4
  4. Interactive tic-tac-toe game with minimax AI
  5. Recursive maze generation
  6. Maze solving

Data Structures

All these should be generic (compile-time parameterized by element type) and constructor/destructor-safe, if applicable.

  1. Dynamic array
  2. Intrusive linked list
  3. Open addressing hash table
  4. B-tree
  5. Slab allocator for fixed-sized items
  6. Chunk-linear allocator (not destructor-safe)
  7. Intrusive reference counting, with strong and weak references

Concurrency

  1. Parallel map
  2. Producer/consumer threads with semaphores
  3. Lock-free append buffer
  4. Work-stealing thread pool
  5. HTTP server with multithreaded request handling and caching

Graphics

  1. Generate an image from a simple mathematical function and output it as a .bmp (bonus points for SIMD evaluation)
  2. Implement Bresenham's line-drawing algorithm
  3. Implement a simple vector/matrix math library
  4. Port Perlin's improved noise
  5. Port stb_image_resize.h
  6. Recursive raytracer with dynamic-dispatch shapes (e.g. spheres and boxes) and materials (e.g. diffuse, shiny, emissive)

Realtime

  1. Realtime 2D particle system with a complex flow field, using SDL or similar (bonus points for SIMD evaluation)
  2. Simple realtime 3D renderer that loads an .obj mesh and draws it using DX/GL
  3. Simple realtime audio mixer that tracks one-shot and looping sounds, with different volume and pan settings

GUI

  1. Simple calculator, with buttons for digits and operations
  2. GUI version of the tic-tac-toe game above
  3. Simple file system explorer, with tree view for directories and list view for files, showing metadata such as file size and mod date
  4. Simple CRUD app for a text localization database, storing Unicode strings identified by an integer ID and a language code
  5. Simple image viewer that allows you to zoom in and out, and shows you the RGB color of a pixel when you mouse over it

Compilers

  1. Parse and evaluate arithmetic expressions like (1 + 2) * 3 using Dijkstra's shunting-yard algorithm
  2. String interning dictionary
  3. Recursive-descent parser that builds an AST for a simple language, with good error messages
  4. Interpreter for a simple language

Metaprogramming

  1. Allocator that infers the correct size and alignment from the type to allocate
  2. Programmatically generate a compile-time-constant integer value with every _n_​th bit set, parameterized by n.
  3. Programatically unroll a loop, given a compile-time-constant number of iterations
  4. Create a text formatting function that recognizes argument types, e.g. print("Foo: {0}", foo) does the right thing whether foo is an int, float, string, etc.
  5. Map strings to types, i.e. user inputs "Foo" and you create a Foo object
  6. Given a regular expression, programmatically generate (at compile time) code that searches that regular expression efficiently
  7. Given a set of command line parameters, programmatically generate (at compile time) code that parses the parameters into variables
  8. Programatically generate bindings for a scripting language (e.g. Python or Lua) for a given set of functions or methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment