Chapter 3

Luna's IQ

Luna has created many projects on Github and one of them is called PogOSM. It is an OS for the Raspberry Pi Pico written in C. Lets take a look!

The PogOSM source tree is full of C files, but no header files! Having header files allows you to build all files on seperate threads in a Makefile, giving faster build speeds and a more streamlined development process. The lack of header files makes this weird to work with.

Lets take a look at kernfs.c

int kern_write(char *data){
    next_ptr = memfs_write(ptr, data);
    //Print ptr
    last_ptr = ptr;
    ptrs[ptriter] = last_ptr;
    ptr = next_ptr;
    lens[ptriter] = strlen(data);
    ptriter++;
    return 0
}

Okay... This is strange. There is a comment saying "Print ptr" but we never print the ptr. And there is no comments on anything else, making this code hard to understand.

Lets keep looking..

shell.c contains a very long block of if else statements making the shell work, instead of having a map of commands and functions. This makes it ugly and hard to maintain. shell.c has comments that make sense though, so I will add points for that!

I will give PogOSM a 2.1 because it is far from perfect, but not horrible either.

PogOSM is a slightly older project, lets look at something newer!

0asm is a programming language by Luna that is close to assembly, 1asm is built on top of it. Lets look at some code!

Example of File IO in 1asm:

proc Main {
    alloc file
    "w" "hello.txt" fopen set file
    get file null? 1 == if {
        "Failed to open \"hello.txt\".\n" .
        1 exit
    }
    get file "Hello, world!" fputs
    get file fclose
    free file
}

This is fairly easy to understand and there is nothing particularly bad about it. Lets look at the V source code for 1asm.

The main.v file fits in 23 lines and is very simple. It calls the parser and the compiler and... thats it! Very understandable.

parser.v and lexer.v do not have any major problems.

My first issue with compile.v is that it loops through nodes twice, once to create function definitions and another to actually compile. It would be preferable if it got function definitions during the parsing/lexing step. I also dislike the use of long if else blocks. It could of been done in a switch, or put into functions.

The C++ code for 0asm is split into header and C files, which I like.

The executor sadly has no comments, and very cryptic code. Making it hard to maintain over time.

The parser also has no comments, but is slightly more understandable. It is modular and looks clean.

This project is well written, with a few minor flaws. I will give this a 2.4-2.5.

Finally, lets look at parader. A web browser for developers

Its easy to install, all you do is pip install -r requirements.txt. I cant criticize the lack of feature's because its meant to be expanded and played with. This code is well written, but quite simple.

I will give this project a 2.6-2.7 because it does not have any big flaws.

I will give Luna's code a 2.6 aswell, it is well written, but has many flaws. Meaning Luna and Stigl have the same approximate IQ range.

Conclusion of chapters 1-3

Luna and Stigl have very similar skills in programming. They just have different programming styles. And it is very hard to tell which one is smarter because they both have such similar intelligence.