EvanWieland / EvanWieland

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


🏗️ Current Pet Project

Pudl is a simple, lightweight, and easily customizable programming language. Go check it out!

About Pudl

Pudl is written using LLVM, the amazing compiler project. I've built this project off of the great work done by Max Balushkin. His approach to building a language without relying on a third party parser/lexer combo - such as Bison/Flex, ANTLR, etc. - intrigued me. Although, I'm changing a lot of the code to fit my needs, Balushkin's work still gave Pudl a huge jump start.

Expect more changes to Pudl in the future. This project is entirely for fun, so progress may be slow.

Example

Pudl source code
func inc( int a ) : int return a + 1

func mast : int {
  print inc( 5 )
  return 0
}
LLVM IR output (after optimization passes)
; ModuleID = 'pudl compiler'
source_filename = "pudl compiler"

@.formati = private constant [4 x i8] c"%d\0A\00"
@.formatf = private constant [4 x i8] c"%f\0A\00"

declare i32 @printf(i8* %0, ...)

define i32 @inc(i32 %a) {
entry:
  %0 = add i32 %a, 1
  ret i32 %0
}

define i32 @mast() {
entry:
  %0 = call i32 @inc(i32 5)
  %1 = call i32 (i8*, ...) @printf(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.formati, i64 0, i64 0), i32 %0)
  ret i32 0
}

Go check Pudl out!


🔥 My Activity

GitHub Streak

Top Langs

About