Oxide, scripting language with Rust-influenced syntax

Language announcement

https://github.com/tuqqu/oxide-lang

Oxide is a programming language I have been working on on my free time for fun.

This is my first attempt to write a programming language and I did enjoy doing it. The syntax is Rust influenced on surface, but feels like a more traditional C-like language.

I wrote a simple documentation as well as example programs to give an overview of the language.

There are still things WIP, but mostly it is stable with the features it has right now.

Posted Mar 29, 2021, 9:05 AM UTC

9519
crundar•
12
helloworderOP•

oh, looks like the name was already claimed by someone in the past :/

Since my project is just a hobby one, I am not sure whether it causes problems.

12
quavan•

At this point almost any name you can think of has already been used for one thing or another. It's pointless to worry about things like that for hobby projects IMO.

34
hum0nx•

It's really nice to have a clever name, but do consider that the nix language and io language are some of the hardest things to debug because google dumps loads and loads of unrelated results. So maybe pick a unique name by getting two words and combining them, invent something totally new or use a language like Latin to find uncommon names that are friendly to search for.

1
xigoi•

Why did you go for C-style for loops instead of iterator-based ones?

11
helloworderOP•

for ... in loops are definitely on the list of improvements. I just haven't got my hands on it yet.

C-style for loops were easier to implement, so I went for them first.

15
johnfrazer783•

FWIW wouldn't a generic loop construct with continue and break be that much more generic? Especially since once you adopt a construct into core you cannot easily throw it out later on, whereas it's much simpler to offer a C-style loop implemented as a macro as an opt-in later.

There was a discussion of C-style loops on this sub on the day after tomorrow (time traveler here), and I must say I always shudder at the syntax. Semicolons within round brackets? Arbitrary order of unnamed terms? Tailored to one specific use case yet imposing boilerplate? Always having to worry you get the i++ vs ++i or the i < n vs i <= n part wrong? All the checks are on the wrong boxes IMO.

1
RobertJacobson•

Very cool! What was the most challenging part to do?

3
helloworderOP•

Thanks! For me it was implementing inner structs mutability (like obj.obj.obj.property = value). It turned out to be not that hard to do, but for some reason I struggled with it the most.

I think my early design choices are to blame here.

4
Rein215•

The code looks very clean and easy to navigate.

3
helloworderOP•

thank you!

1
AraripeManakin•

What resources did you use for learning. Im amazed you wrote statically typed language at first attempt.

3
helloworderOP•

Thanks, but I am not sure if my language fits formal definition of statically typed languages, tbh. More likely it does not.

"Crafting Interpreters" by Nystrom is a great book to get started, it helped me a lot with understanding the concepts. I also picked up a few things from "Writing interpreters in Go" by Thorsten.

9
AraripeManakin•

But still, you have type specifications which I still dont have idea how to implement.

Im currently reading crafting interpreters, but I have a long road ahead of me.

I think i am not able to make language like yours with first attempt.

1
helloworderOP•

I believe once you grasp the basics, you'll become more confident. Types are not harder than some other features you will encounter.

4
CRefice•

Good stuff! I _also_ made a scripting language with Rust-influenced syntax named Oxide! Guess the name is not that big of a stretch of the imagination :)

1
helloworderOP•

thanks! Oh wow, haha, it seems that "oxide" is a very attractive name when you have something related to Rust in mind. Cool, I like how you implemented the block-expression thing.

1
TizioCaio84•

Very cool! I assume you are using a garbage collecting strategy of some kind. How did you go about implementing it?

1
helloworderOP•

Thank you. To be fair, it is overly simplistic at the moment and values are basically overwritten / deleted each time there is an assignment of some kind or a function call.

I've not dig into it much, but GC is definitely a thing yet to properly implement.

1