GitHub - iamgio/pikt: :art: Image-based poetic programming language.
Key Points
- 1Pikt is a pixel-based, dynamically typed, Turing complete esoteric programming language that generates executable programs from aesthetically pleasant image sources.
- 2It compiles code into executables using the Kotlin compiler for JVM and native targets, with all language elements customizable via user-defined color schemes.
- 3The language offers extensive command-line utilities for image transformation, color scheme management, and string conversion, enabling diverse programming applications.
Pikt is an image-based, dynamically typed, and Turing complete esoteric programming language designed to generate fast and lightweight programs from aesthetically pleasant image sources. Its core methodology revolves around the concept that the source code *is* an image, where every keyword, statement, function, and operator is linked to one or more specific colors. This mapping is highly customizable through user-defined color schemes, allowing for significant flexibility in how programs are visually represented.
The technical process involves Pikt compiling these image-based programs into Kotlin code. This generated Kotlin code can then be compiled by the Kotlin compiler (kotlinc) to target either the Java Virtual Machine (JVM) for cross-platform execution or native binaries for specific operating systems (though native compilation for Windows, macOS, and Linux is currently disabled, with JVM being the primary supported target). Alongside compilation, Pikt also supports runtime interpretation of the generated Kotlin code.
Key features and functionalities of Pikt include:
- Customizable Color Schemes: The foundational element allowing users to define the color-to-language-construct mapping, enabling unique visual programming styles.
- Examples: Provided examples demonstrate its capabilities, such as Fibonacci sequence, prime numbers, FizzBuzz, insertion sort, string reverser, and a "tree" program, often utilizing custom color schemes.
- Execution Properties: Programs are run via . Essential properties include
-Dsource(input image),-Doutput(output name),-Dcolors(path to color scheme),-Dtargets(compilation targets, e.g.,jvm),-Dlib(JAR libraries),-Djvmcompiler(path tokotlinc),-Dproject, and-Dtask. - Behavioral Settings: Arguments like
--interpret(runs code via JVM compiler),--printoutput(displays generated Kotlin),--nocompile(prevents executable generation),--pixelinfo(adds pixel coordinates as comments),--imgoutput(sets output for image-generating commands),--chainoutput(chains image outputs), and--pl[=type](sets pixel logger type for compile-time error visualization, with types likenone,16,256,rgb,box). - Command Arguments: A set of utility commands are available for various tasks unrelated to code generation or compilation, often involving image transformations. These include
downloadcompiler(downloadskotlinc),createscheme(generates a default color scheme),exportscheme(creates a color palette image),recolorize(adapts an image to a custom scheme),standardize(adapts an image to the default scheme),compact(removes whitespace between pixels),decompact(adds newlines),colorswap(swaps hex colors),mask(applies an image mask),strconvert(converts a string to RGB grayscale values), andwelcome(a setup wizard for Hello World).
To build Pikt from source, users can execute mvn clean install. The project roadmap outlines planned future language features, including variables, constants, function calls and definitions, control flow (if/else, loops), lambdas, operators, error handling, and runtime information. Native compilation support is temporarily discontinued but planned for a long-term return.