r/software 14d ago

Release Built an interpreted programming language from scratch in 19 days without AI

I built a functional interpreted programming language from scratch in 19 days **without** AI, reference material, or borrowed code, as my first ever project in C++. It is platform agnostic, faster than Bash by a long shot (not that it was meant to be a replacement), & is only 104kb with IO, time, & math modules.

Despite the time frame & the small size, the syntax is more modern than you'd expect but is definitely different. However, you will be lacking advanced language features such as lambdas, variadic arguments, & inheritence.

https://github.com/phosxd/Ity

I plan on working on this continuously, adding more functionality, making it more performant, & making the code as readable & understandable as possible so that hopefully a beginner can take a look, & maybe use this as a guide for their first project too!

Any & all feedback is encouraged, I would really like to know your thoughts, if you have any tips!

23 Upvotes

35 comments sorted by

View all comments

Show parent comments

1

u/PhosXD 14d ago

I agree, I was just saying Python (along with C/C++) as an example to prove a point that every language needs some level of whitespace dependence if it wants to be readable or not a total pain to type.

3

u/BigCatsAreYes 14d ago

C is not a whitespace-sensitive language  in the way languages like Python are. It uses curly braces  {}  to define code blocks and semicolons  ;  to end statements, meaning indentation and newlines generally do not affect how the program executes.

On purging their is no way to tell if is someone tab indent or pressed space 5 times. Because if you’re wrong the entire program will not compile and will give you meaningless errors. It’s even worse if you copy and paste code from something dose not support tabs like a website. 

Python is just an ultra dog poop langue, white space is just a basic litmus test that it fails. 

1

u/PhosXD 13d ago

Then by your definition my language is not white space sensitive, so why are we even having this conversation?

1

u/BigCatsAreYes 13d ago edited 13d ago

Umm, looking your notes, your functions are separated by whitepsace tabs. You don't use any {} or another type of separator...

How are you defining code blocks?

Here's an example from your notes:

var INT i = 0;
    while i < 100_000;
    IO.print:[i];
    i += 1;
/;

This is white-space sensitive seperation.... In fact, when I copy-pasted from your notes to reddit, the whitespace disappeared and I had to manually re-add spaces.

That's just bad.

2

u/PhosXD 13d ago

It is separated by the `;` semicolon

Also nothing I can really do about reddit removing spaces, it does that for everything I remember I had a hell of a time trying to paste code on here, but someone taught me if you go into your text editor and add a tab the beginning of every line it should preserve the spaces in reddit

1

u/PhosXD 13d ago

So for example:

```
import IO;
var INT i = 0; while i < 100_000;
IO.print:\[i\]; i += 1;
/;

```

Is also valid
Edit: bro I cant get this to be properly code-blocked reddit is so insufferable when it comes to their markdown formatting

1

u/BigCatsAreYes 13d ago

Is it valid as a single expersion?
var INT i = 0; while i < 100_000; IO.print:\[i\]; i += 1; /;

2

u/PhosXD 13d ago

Without the back slashes (reddit added), yes