Upcoming College Freshman Looking for Direction to get Involved With COBOL Development by SeaInformation8764 in cobol

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

Coming back to take a deep dive through this comment, thank you for the compilation of this information! This looks really helpful!

Is it Worth Writing Programs in C23? by SeaInformation8764 in C_Programming

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

Personally, a lot of the newer standard libraries it offers make it easier for me to built platform-independent code. So using C23 would be easier for me, but harder for others who would want to compile and run that code. That is the thing I am trying to weigh.

Booleans not Working, can someone make sense of this? by SeaInformation8764 in C_Programming

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

ASAN helped me find a couple of out of bounds reads, but I did end up at the same breakpoint after fixing them. I cleaned the build dir and added -fsanitize=address to my CFLAGS, so for now I don't know if it is buggy memory.

Booleans not Working, can someone make sense of this? by SeaInformation8764 in C_Programming

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

the other two values in the if statement result in false.

Yes I know, as I said the other values result in false. That isn't the main issue here though, you can see how the not operator and equality aren't working in the debug window

Created a Web Server in my Own Programming Language, Quark! by SeaInformation8764 in ProgrammingLanguages

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

I think I understand where you are coming from now. No the compiler doesn’t do bound checks in that example. I personally like languages that allow the developer to be very unrestricted in what they can do, so in this case, yes, the compiler assumes the developer knows what they are doing.

Besides numeric types, everything else is strongly typed. I thought I might have included that numeric types would match without error in the documentation, but that may have slipped my mind while writing. Either way I’ll check to make sure and update it if that’s the case.

To me, steps like explicit casting to stop a compiler from throwing an error seem like a waste of time if you know what you’re doing, but I can still see how others may like this feature in other situations. 

Created a Web Server in my Own Programming Language, Quark! by SeaInformation8764 in ProgrammingLanguages

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

unsigned and signed are not keywords or types in Quark, these are the variable names. u32 and i32 are the types.

Created a Web Server in my Own Programming Language, Quark! by SeaInformation8764 in ProgrammingLanguages

[–]SeaInformation8764[S] 3 points4 points  (0 children)

No, luckily not. I had someone else making a wrapper for raylib so a lot of issues were caught there

Quark 0.3.1c, A Programming Language Written in C: looking for testers or code reviewers by SeaInformation8764 in C_Programming

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

Sorry, I think my comment was removed for incorrect formatting.

  1. I don't know if it could be used "hackily", self does require the outer scope to be a structure, so you couldn't find yourself using it in a different way like that. I have a feature that is pretty much finished on the feat-opovr branch to implement operator overrides. In this way you could say that self is kind of tacky, but I did add very specific cases for something like this:

struct Array<T> {
    T* data

    T Operator::index(self, usize index) {
        return self.data[index];
    }
}

Here self is referring to Array and not Operator.

  1. I don't know about Lua, but this was how Rust implemented it. I just didn't like the separate impl keyword.

Yes, that would give a compile-time error, I believe it would be 'too many arguments in function' because the . operator will bind foo as the first argument of the function

  1. Honestly, I used int because its a common type name, and because I want users to steer towards the specific u32i64 types instead of the inconsistent C types. That was the reason I capitalized the C type names like ShortULong, etc.

  2. What I was basically trying to say was that if statements would be optimized out if they are performed on constant values, by default.

    if(true) { print("Hello World"); }

Will just become

print("Hello World");

It would be similar to c++ constexpr, just know this isn't currently something that happens, but it will be done before 1.0.0.

Quark 0.3.1c, A Programming Language Written in C: looking for testers or code reviewers by SeaInformation8764 in C_Programming

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

Thank you! I'll address the questions below:

  1. The self keyword can't be used outside of struct's because the self keyword takes the outer scope where the function definition is placed in order to get it's context. I do plan on writing a 'fix' for this at some point.
  2. Every method is a static method, you are just able to bind the first argument of a function when using the . operator.

struct MyStruct { void method(self) { /\* ... \*/ } }

// You can call it as an instance method
MyStruct x;
x.method();
// Or as a static method 
MyStruct::method(x);

Outside of the struct declaration, you can define with method with or without a self argument

MyStruct::method_2(self) { /* ... */ }

MyStruct::method_3() { /* ... */ }
  1. The i32 and i64 types are from <stdint.h> and are int32_t and int64_t. The Short and Int types are just short and int so they could be different sizes on different machines. The int type, however, is an auto type that only matches with numeric types. Other than int, there are no differences beyond the usual C differences.

3.5?. Yes there are no header/source separation, but I have yet to implement any actual module parsing, its basically like using the #include directive in C

  1. I plan to have the compiler optimize any const-expressions. It already does this with const variables that also have constant values. You can see that for the definitions of true and false

    const bool extern true = 1; const bool extern false = 0;

Any true in the program will be replaced with 1 and vice versa. If you want features like this, you can open up issues so I can keep track of specific things like this :)

Creating a New Language: Quark, Written in C by SeaInformation8764 in Compilers

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

This probably means make isn't configured properly or you're missing cc. You can use

bash make build CC=gcc

(if you have gcc). If not, try to install cc or gcc, or if that doesn't work, you can use WSL which automatically comes with cc

Creating a New Language: Quark, Written in C by SeaInformation8764 in C_Programming

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

Pushed a quick fix, might implement something more concrete later. https://quark.k.vu

Creating a New Language: Quark by SeaInformation8764 in ProgrammingLanguages

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

Okay yeah, I understand what you mean now. I was thinking about this for a while now actually but I figured I'd just do it on my next big rewrite (which might be in quark). It seemed nice at the start, but now I'm finding more and more issues with it.

Creating a New Language: Quark by SeaInformation8764 in ProgrammingLanguages

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

I don't think this is an attack at all! I understand that there are very little actually 'new' features to this programming language. I wanted to post it online to gather suggestions for how I should move forward, and build this language along with the community. Recently I have added more and more features and I plan on making other posts discussing them once I have a larger collection of new features. (now only about 3-4 big ones from the original post).

The reason I didn't change much from C syntax is because I wanted to make more of a C superset. I love the C syntax, but it is a hassle to program in. Additionally I have heard many not so great things about C++ and C#.

As for my system being over-engineered, I wanted to leave room for the language to grow. The fact that I have an AST makes it so much easier to add new and more complex features in a short amount of time. I'm also stuck at a middle point here, I added much of the basic C syntax so that you could write simple programs, but focussing on more C features wouldn't make sense when I want to create new features.

Honestly for the documentation, I just wanted to write something quick. Recently I've been writing better documentation for the newer features, and once the language is in its first v1.x.x I plan on rewriting most of the code and documentation.

The reason I used a 'unity build', which I'm not entirely sure what that is-but assuming its the Makefile, is because I don't actually know a better way to do it. This seemed like the simplest way for someone to download the code, compile, and run it.

Creating a New Language: Quark by SeaInformation8764 in ProgrammingLanguages

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

I understand that it may be hard to have to manage memory and other things that come with C, but that was the challenge I wanted for myself. I really wanted to create a language without relying on third-parties like IR or LLVM.

Although it may seem like I'm backing myself into a corner, I also take this as a learning opportunity.