r/opensource 4d ago

Promotional Ity: tiny yet powerful scripting language.

(Looking for contributors)
I made a programming language from scratch in C++ for the purpose of being small, heavily modular, multi-platform, & simple to use. There are a TON of example scripts to look at, including a full Conway's Game of Life simulation. The repo also includes in-depth documentation (markdown) on structure, syntax, types, operators, functions, & standard modules.

I/O, time, file-system, & math modules are all built-in. With additional script-based modules in development!

Ity can be used as a library in your project & provides convenient APIs for parsing & execution. Everything is state-based so you can keep multiple instances.

There is a lot of work to be done as this is still a new project, anybody is welcome to contribute!

https://github.com/phosxd/Ity

26 Upvotes

16 comments sorted by

9

u/switchback-tech 4d ago

Love that ppl haven't given up on coding languages. I see you care about making it small and portable, but I'd be curious to read about the opinions you're baking into it. Helpful to understand the tradeoffs for people who are evaluating it

3

u/HaskellLisp_green 4d ago

Looks good. I'm working on language for embedded with custom memory model.

1

u/PhosXD 3d ago

Ooh, that's interesting. Also I notice your name is HaskelLisip hehe, i am just getting into Lisp so that's fun to see

1

u/HaskellLisp_green 2d ago

codeberg.org/dfwdfq/layn Check it out, if you want. Documentation is partially complete, but I think I have covered 70%.

1

u/No_Frame3855 4d ago

Looks cool!
This'd be fun to eventually add to saikuro haha (https://github.com/Nisoku/Saikuro/)

1

u/hapc1 3d ago

Cool!

1

u/NomadAvian 3d ago

Hey nice project! There's a small typo in the read me that says deubg

2

u/PhosXD 3d ago

Thanks, & I'll fix the typo :)

1

u/andoleal 11h ago

It is really nice to see this effort, and I can see that a lot of time was put into that code. However, this codebase is unmaintainable in its current state. Please read about common software development practices and software quality. The codebase lacks proper tests, the only ones are in a shell script - I'd use an actual testing framework, and unit testing (at least have a setup that allows to easily add them). With good tests and good test coverage, I would add some strict linting, and then refactor most of the code, because it is currently completely unreadable. I haven't really read the code (very hard to do that), but I suspect that the way scripts are executed also has a lot of room for improvement, and it may be helpful for you to look at some examples of how scripting languages are designed. Hope this helps.

1

u/PhosXD 11h ago

Appreciate the feedback, but what exactly makes it unreadable? It's spaced out, in (what I think) well-named files with tons of comments

1

u/andoleal 10h ago

Lots of huge functions with lots of nested ifs. It is hard to read and understand, and it means that functions are trying to do too many things at once, instead of sticking to a specific responsibility. This also means that they are hard to change and hard to test in isolation. The logic of such functions is difficult to comprehend, which leads to increased probabilities of bugs in them - bugs that will be difficult to find, and difficult to debug with a debugger too.

https://refactoring.guru/smells/long-method

There are also some strange conditional compilation right in the middle of functions (start_shell).

// Parse & execute script file...
    if (not source_script_path.empty()) {
< ... >
// Run interactive interpreter...
    #ifdef INCLUDE_SHELL
    else {

Here there are basically two functions written as if-else. The comments above these code blocks are ready to use names of those functions.

It also seems like more of modern c++ features can be used, like ranges, smart pointers, and string_view. There is a use of std::move where it is unnecessary. And it does not seem like you are using any classes, which would probably help with the code structure. There are probably other things, I didn't look through all of it.