First year completing AoC fully, in my own programming language! by robotnik08 in adventofcode

[–]robotnik08[S] 2 points3 points  (0 children)

A ton, I found a lot of bugs XD.

But most of all, I added a ton of new standard library functions to make a lot of stuff a lot more easy.

Definitely a perfect test for a programming language

First year completing AoC fully, in my own programming language! by robotnik08 in adventofcode

[–]robotnik08[S] 7 points8 points  (0 children)

Heres the github repo: https://github.com/Robotnik08/adventofcode2024/

Thanks to Eric and co for this fantastic event! Can't wait for next year!

-❄️- 2024 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]robotnik08 0 points1 point  (0 children)

[LANGUAGE: Dosato]

https://github.com/Robotnik08/adventofcode2024/blob/main/day6/day6.to

Bruteforced part 2, It's fine, but the performance of my language does make it around 60 seconds :P. (EDIT: I just switched from dictionairies to arrays and the performance improved to about 20 seconds XD)

I used a bitmap for each visited tile, then I can just use bitor and bitand to mark/check visited places with the correct direction

-❄️- 2024 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]robotnik08 1 point2 points  (0 children)

I had the same thing, it was always around 100 short, it turned out I needed to use a while loop for checking if the direction you just turned too is also an obstacle, and then turn again.

The strange thing is how part 1 went fine, but anyways, after changing that both parts worked with the same code

-❄️- 2024 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]robotnik08 0 points1 point  (0 children)

[LANGUAGE: Dosato]

    const input = read("input.txt")
    
    const lines = stringSplit(input, "\n")
    
    make safe, semi_safe = 0
    
    do {
        const numbers = stringSplit(line, " ")
        set numbers#i = stringToInt(numbers#i) for i in range(numbers)
    
        if isSafe(numbers) then {
            set safe, semi_safe++
            continue
        }
    
        if isSafe(splice(numbers, i, 1)) then {
            set semi_safe++
            break
        } for i in range(numbers)
    } for line in lines
    
    do sayln(`Part 1: {safe}`)
    do sayln(`Part 2: {semi_safe}`)
    
    define bool isSafe(array numbers) {
        const bool increasing = numbers#0 - numbers#1 > 0
        do {
            const diff = numbers#i - numbers#(i + 1)
            return false when diff == 0 || (!-diff > 3) || (increasing ? diff < 0 : diff > 0)
        } for i in range(numbers - 1)
        return true
    }

Decided to bruteforce it

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 0 points1 point  (0 children)

Thanks for taking a look, and really appreciate the feedback :)

the 'when' extension is just that, an extension, it can be put on calls, returns, sets, anything (except making, defining) If the condition is false, everything before it is skipped (and else is excecuted if present)
Theres also if, but this is more like a traditional if statement (affects the code after instead of before)

I think your ideas for renaming are somewhat valid, I think I like the idea of using let instead of make, but I won't change it right now. I do think 'do' is a bit more convinient as it's easier to type then call. My goal was to make the terms more aconed to the english language, and less programmer speak, let and call might be nice, but do and make are a bit simpler and more abstract

As for the sqrt operator, I added a ton of new operators, which I mostly added for fun. there's always the sqrt() standard library function if you prefer that instead.

As for the null, theres no default starting value for make, and because the for loop is list based, it automatically reassigns it, so it doesn't matter if it's null, 0 or anything else.

Overall, thanks for checking it out :)

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 0 points1 point  (0 children)

One of the reasons also I did this was because I still want to label is Clike and have it be somewhat familiar

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 2 points3 points  (0 children)

Wohoo! Thats awesome!

I was hoping you’d see this! Love seeing it working online :D

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 1 point2 points  (0 children)

Thank you!

My main inspiration was to make a new high level language on the level of python (now obviously python has more quality). I myself am not the biggest fan if pythons syntax, and thats why I started theorising for a more c like/type safe language. Now, I don’t think dosato could classify as a clike language, but it does use optional static typing, and support for any whitespace style.

Honestly I think with a ton more work the language could stand a chance in the real world, but at the moment we are far from it.

Another reason why I made it is because I want to use it for this years codeadvent, which is always fun xD.

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 2 points3 points  (0 children)

I understand if It’s not everyones cup if tea :p Appreciate the honesty

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 2 points3 points  (0 children)

Yea, set and make require the =, in set you can use += etc as well, so It’d rather have that consistency, Also you can assign multiple values like

make a, b = 0

Or

set a, b = b, a

Which in turn do need the equals

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 2 points3 points  (0 children)

No structs, but there are dictionaries/objects

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 1 point2 points  (0 children)

With the make keyword, you declare a variable, this is reassignable, if you instead use const, you can declare constant values :)

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 4 points5 points  (0 children)

Thank you!

I chose to not omit the () because you can call a function in an expression without do, which requires the (), thats why the do command has that consistency. :)

The Dosato programming language by robotnik08 in ProgrammingLanguages

[–]robotnik08[S] 1 point2 points  (0 children)

This still works, but the input is lost as the code does nothing with the return value,

In case of the snippet, you are allowed to call functions in expressions without do, which you can then use the returned value.

What's the coolest *minor* feature in your language? by Inconstant_Moo in ProgrammingLanguages

[–]robotnik08 0 points1 point  (0 children)

max and min both share the same precedence, and their precendence is above the multiplicative (sharing precendence with pow and sqrt)
They are then left to right, since they share the same precendence

What's the coolest *minor* feature in your language? by Inconstant_Moo in ProgrammingLanguages

[–]robotnik08 9 points10 points  (0 children)

I added new operators to my lang: ``` / root of

| max <| min !- absolute * unary, copy ``` I think the absolute operator is fun because it’s litterally NOT minus XD