NICUP14 / MiniLang

A type-safe C successor that compiles directly to various platforms.
MIT License
138 stars 3 forks source link

For Standard Library or Another Thing #1

Closed yakupcemilk closed 1 month ago

yakupcemilk commented 3 months ago

I hope you are well, we talked before at reddit and I said I can help if there is things to do at this excellent project. If there is anything to do, I can handle it with your permission.

NICUP14 commented 3 months ago

Yeah man, a good first contribution would be enum. All enum members should have the same element type. The len_of builtin should return the number of members. size_of builtin should also work. Check how structs are implemented in the language, it would be really helpful since the parsing syntax is nearly identical (enums could even be represented by the compiler as a struct)

enum myenum
  a = 15
  # Or: member: type = ...
  c: int8 = 15
end

=> len_of(myenum) == 2 => size_of(myenum) = sizeof(myenum) (the c builtin) => type_of(myenum) == "enum"

NICUP14 commented 3 months ago

I would also appreciate any contributions to the standard library if you have any ideas to add/improve any libraries.

yakupcemilk commented 3 months ago

This is needed and I understand it well, give me 1 week for reading and understanding the whole project. I'm moving to another country, so, I'll be busy for a week but I want to make this contribution. Thank you for your response.

yakupcemilk commented 3 months ago

I would also appreciate any contributions to the standard library if you have any ideas to add/improve any libraries.

I think Minilang needs basic media and a GUI library. For the standard library I'll prepare a report to you about what I can do.

Edit: most of the languages don't have these and most of the people who see the language for the first time, don't want to create hard-work needed libraries. They want ready-for-development.

NICUP14 commented 3 months ago

It's all yours man. There's lots of features which are missing, plus documentation plus standard library among other things which I probably missed. I'll do something else in the meantime

yakupcemilk commented 3 months ago

It's all yours man. There's lots of features which are missing, plus documentation plus standard library among other things which I probably missed. I'll do something else in the meantime

I'll be working hard for Minilang, it is like my Syscall project. I love the project. So, I think I'll be well enjoyed when I work on it.

NICUP14 commented 3 months ago

Glad you like the project. Appreciate it!

yakupcemilk commented 3 months ago

Glad you like the project. Appreciate it!

Thank you!

yakupcemilk commented 3 months ago

Can you read the proof of concept codes for the enums at my repo and enum branch? There is things to do but I want to kindly asked about your plan for enums.

NICUP14 commented 3 months ago

I will take a look rn

NICUP14 commented 3 months ago

What I meant about the builtins like size_of, len_of and type_of are part of the language. The are parsed internally similar to macros and are expanded in the src.backend.c.CDef.c_expand_builtin(). Take a look at that. Parsing those builtins is already taken care of, you just need change that function a bit to make it work with enums.

yakupcemilk commented 3 months ago

What I meant about the builtins like size_of, len_of and type_of are part of the language. The are parsed internally similar to macros and are expanded in the src.backend.c.CDef.c_expand_builtin(). Take a look at that. Parsing those builtins is already taken care of, you just need change that function a bit to make it work with enums.

Of course, I create these for proof of concepts. There is a comment about C builtin but because of the busy week, I can't read all of the codes. But after the week I will fully focus on the subject. I asked to see what I have on my mind. I think the proof of concept can be usable.

Edit: You can reach me Slack, Discord, E-mail or anything you want. It will be more comfortable.

NICUP14 commented 3 months ago

What I meant about the builtins like size_of, len_of and type_of are part of the language. The are parsed internally similar to macros and are expanded in the src.backend.c.CDef.c_expand_builtin(). Take a look at that. Parsing those builtins is already taken care of, you just need change that function a bit to make it work with enums.

Of course, I create these for proof of concepts. There is a comment about C builtin but because of the busy week, I can't read all of the codes. But after the week I will fully focus on the subject. I asked to see what I have on my mind. I think the proof of concept can be usable.

Edit: You can reach me Slack, Discord, E-mail or anything you want. It will be more comfortable.

Agreed, I've sent you a mail containing my contact information.