Sparkpin

Hello there! My name is Ruby Lord, and I'm an aspiring computer programmer. I don't take life seriously enough, but I really need to take life more seriously.

For more information, check out the About page.

Occasionally, I might post stuff on here. You can see my posts here:



  • Not So Fast

    Sorry for the long absence. I was intending to post whenever I finished Spinel 0.2.0, but I haven’t been able to get there. One blocker is that my virtual memory system appears to be corrupting everything at spurious moments. I’ve yet to debug what the virtual memory system is doing to cause such a spectacular failure. This may or may not be why my scheduler implementation is broken. At least I have partial implementation of the scheduler.

    Spinel 0.2.0 WIP, showing RNG initialization and PCI device searching
    There's some new stuff here, but still no usermode!

    Perhaps another reason why I still don’t have usermode is that I got seriously sidetracked a couple of times. You can see that I now have a kernelspace RNG. This isn’t just some linear congruential generator, it’s based off of the ChaCha20 stream cipher, also used in {Free,Open,Net,DragonFly }BSD and Linux. It currently doesn’t have a very good scheme for its entropy pool (something was causing memory corruption when using a pool. As discussed above, it turned out to not be the RNG, so I might add a proper pool sometime soon), but it still works! It’s probably not correct since I wrote the implementation and I’m not an expert at cryptography or anything else, but it was still a fun learning experience.

    And yet Spinel doesn’t even get to user mode.

    If Spinel still sounds interesting to you, check out Spinel on GitHub!

    I’m sorry for not getting that much work done. University has continued despite everything, and so have my own mental health issues, although I’m doing a bit better at the moment.

    One more thing: recently, I’ve started work on a programming language that I’d like to try to implement as a challenge. Currently, it’s named ColdDivinity. It’s sort of a blend between Rust and C{,++}, with some inspiration from Python, Haskell, and a bit of C# (definitely that and not Java ;)). It doesn’t set out to be a safe language like Rust (although perhaps a safe mode could be devised, and even without it some static analysis would probably be good); it tries to capture what an ideal programming language is for me, so that I can have fun implementing it and then maybe even using it (maybe for a certain operating system?).

    Of course, being a language that I’d like to use, it is primarily intended to be compiled to native binaries. Maybe there could be a JIT compiler (the grammar currently makes allowances for a shebang for that reason), but the primary use case is ahead-of-time compilation, like C{,++}, Rust, etc.

    I should say up front that I unfortunately don’t have any sort of compiler for this yet, but I’m working on it. I’m struggling a little to write a code generator…

    Here’s an example program, written following the prototypical grammar:

    import standard.abort;
    import standard.io.print;
    
    // "data Foo {...}" creates an algebraic data type
    // This is equivalent to Rust's Option
    // Of course, the standard library will probably have an optional type
    // This is just a demonstration
    data MyOption<T> {
        Some(T),
        None
    }
    
    // Return type has been elided; the full header is:
    // def T getValueOrDie<T>(MyOption<T> val)
    def getValueOrDie<T>(MyOption<T> val) {
        switch val {
            case Some(x) {
                x
            }
    
            case None {
                abort("getValueOrDie didn't get a value, and thus died!");
            }
        }
    }
    
    def main() {
        let MyOption<int> naught = MyOption.None;
        let something = MyOption.Some(5);
        print(f"Got {getValueOrDie(something)} from something");
        // will abort
        getValueOrDie(naught);
    }
    

    Some notable things:

    • data declares an algebraic data type, like Rust’s enum or Haskell’s data. This keyword is not final; I might change it to something like adt.
    • Return types can be elided.
    • Modules.
    • Python’s f string syntax is planned to be included.
    • Generics! Notable: there will probably be an equivalent to Rust’s impl Trait syntax.
    • Although I used camelCase, no name styles will be enforced by the language.
    • All variables are immutable unless declared mutable, as in Rust.
    let int x = 4;
    x = 7; // Error
    
    let mutable int y = 4;
    y = 7; // Ok
    
    • Integer overflow is defined behaviour. If you don’t want this, you can use the nooverflow specifier.
    let u8 x = 255;
    let nooverflow u8 y = 255;
    x++; // x = 0
    y++; // Error
    
    • ColD const ≈ C++ const{expr,eval}
    const NumItems = 4;
    static items = [0; NumItems]; // Bonus: Rust list-filling syntax
    
    def const coolFunction() {
        const if __Endianness == __PDPEndian {
            asm("hcf");
        }
    }
    
    • ColD will have classes, similar to in C++. More below.
    • Rust-like traits, but you can also put member variables in them.

    A couple more examples:

    Using a lambda

    import standard.io.print;
    
    def main() {
        let int[10] numbers = [1..10];
        print(f"The numbers 1-10: {numbers}");
        let numbers = map(lambda (x) { x * x }, numbers);
        print(f"The numbers 1-10, but squared: {numbers}");
    }
    
    

    Classes and traits

    import standard.io.print;
    
    trait Lawyer {
        static string name;
    
        // "nothing" is analagous to void in C or () in Rust/Haskell
        decl public nothing exclaim();
    
        def public string getName() {
            return name;
        }
    }
    
    class Wright implements Lawyer {
        static string name = "Phoenix Wright";
    
        def public exclaim() {
            print("Objection!");
        }
    }
    
    class Edgeworth implements Lawyer {
        static string name = "Miles Edgeworth";
    
        def public exclaim() {
            print("Eureka!");
        }
    }
    
    // A bit tripe but can be expanded upon
    // Definitely not final syntax for trait parameters
    def makeExclaim(Lawyer l) {
        l.exclaim();
    }
    
    def main() {
        let Edgeworth miles;
        let Wright phoenix;
        makeExclaim(phoenix);
        makeExclaim(miles);
    }
    

    That went on for quite a bit longer than I thought, especially the part about ColdDivinity. In any case, thank you for reading! See you next time!

  • Dim Dream of a Bright Future

    Progress on Spinel is going quite well, I think:

    The Spinel operating system, rejuvinated
    New and improved

    …hmm. It looks mostly the same. That’s because I restarted development around 2020-02-20 for many reasons. I was able to get it (mostly) up to feature parity, so I’ve gone ahead and merged the reset version into the main branch. On top of that, this new version also has a functioning memory manager, which is always a good thing.

    I’ve also gone ahead and released the source code for Spinel. You can find it here, if you’re so inclined.

    In other news, university has been kind of a slog recently. If you know me at all, you might’ve heard me talking about how the modern public university system isn’t well equiped to handle those with restricted interests. I’m taking an atmosphere science class right now, and I’m supposed to be a computer science student (sort of… I’m technically undeclared…). I’ve applied for transfer, but they don’t seem interested in accepting my physics or atmosphere science credits, so I’d have to take another physical science class…

    Fortunately, I think I have an out. My goal is ultimately to become a professional programmer, right?

    So what if I just did that?

    Now, it probably won’t be easy and probably will take time, but if I can pull this off, I can break out of this rather restrictive system and into doing what I love.

    I’ve already been enacting this plan. Recently, a company has reached out to me and provided me with a technical examination. It was exhilirating. I think it was probably one of the most fun tests I’ve taken in my life. That’s part of why I’m going through with this plan.

    I have no idea who’s reading this blog, if anyone, but thank you. I have no idea if my little progress reports are interesting to anyone, but I might at least keep posting about Spinel’s progress here. Maybe. I’m not sure.

    Maybe I might take up art and post that on here. Or Twitter. Or both. Who knows?

    Sorry for going off on tangents upon tangents.

    See you next time!

  • Insufficient Memory

    …wow, it took me just under a year to make a second post. I’m sure all two of you who stumbled upon this website have been eagerly awaiting my next post [:P]. I might as well give a bit of a status update.

    I’ve started working on an x86 operating system, Spinel, in December 2019. It’s a very early WIP and is unfortunately dormant due to classes starting back up. Depending on how things go, I might be able to work on it more as my course load may be eased.

    The Spinel operating system crashing
    I have to fix the memory manager...

    Unfortunately, I probably still won’t post very frequently. There’s just not much a general audience would be interested in, and I have no active followers (except maybe for a few people). Maybe I could start posting more about computers or computer history? Maybe I can talk about Spinel? I know that depending on how certain upcoming events go in my life, I might suddenly find myself with quite a bit of content to post that may be useful to someone surfing search results. I know that’s a little vague (okay, very vague), but I’m a little wary of making assertions that might not be true.

    See you next time!

subscribe via RSS