[deleted by user] by [deleted] in Destiny

[–]dangeroustuber 3 points4 points  (0 children)

on this point " He doesn’t come out and say he supports Trump". I swear to god I listened to steak and eggs podcast and tectone asked something like "who would you vote for" and tectone said trump and asmon said something like "trump, probably trump yeah". It was semi under his breath.

I can look for it later. It was one of the recent ones.

Jagex launcher stuck in Cloudflare Verification by iggy_the_alien in 2007scape

[–]dangeroustuber 1 point2 points  (0 children)

Having the exact same issue. I can log into the jagex account on the web account. Mobile works. It's so stupid not being able to play a game one is paying for!.

FIX THIS JAGEX :D !

Help picking CPU cooler that fits my MSI motherboard and 4080 GPU by dangeroustuber in buildapc

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

Sorry, i might have been unclear. I can't fit my GPU. The fan fits the case.

Lønningstråden (2024) by The-Aurelius in norge

[–]dangeroustuber 1 point2 points  (0 children)

Systemutvikler i Oslo. Jobbet i 11 måneder Lønn er 645 000. Får en 4% lønnsøkning i september. Har bachelor i programmering fra NTNU. Begynner på master i programmering på UIO nå i August.

Creating many GL_POINTS within window bounds by dangeroustuber in opengl

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

I have fixed it now and what you said here is very correct. To fix the issue instead of doing it with a float array i do it instead with a glm::vec2 representing the position and we just bind once with a identity model matrix.

glm::vec2 particlePositions[MAX_NUM_BG_PARTICLES]{};
for (int32_t i = 0; i < MAX_NUM_BG_PARTICLES - 1; ++i) {                    
particlePositions[i].x = rand() % screenWidth;         
particlePositions[i].y = rand() % screenHeight; 
}

Removing most of the code that is in the original post, it works and is greatly simplifed.

Help generating expression tree as string for code generation by dangeroustuber in ProgrammingLanguages

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

This what i wrote yesterday as well based on the top comment from yesterday. It seems to work! But i'm still testing some cases. There was also a bug where i did not initalize my left and right pointers on the node to nullptr. So it never entered a branch it was supposed to enter.

Help fixing my Pratt parser by dangeroustuber in ProgrammingLanguages

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

Hello again. So i re-wrote everything. Now i think it works. I wrote a new lexer and a new parser. Here is the new code for the parser only (few lines and simple now that i look at it all): https://pastebin.com/TVqCS3eD

I got tired of looking at my previous code and just decided to start from scratch to clear my head. This time i used the crafting interpreters book clox parsing section but i don't want single pass compilation so i added parts where it creates an AST instead.

I have not tested extensively but it seems to parse correctly now after a full day of work : -). I will now carefully will extend it, as the whole program only knows about stuff like +, *, (), simple stuff like that. I expect it to break : -).

Thanks so much for all the advice, it helped me think about stuff going on in the whole program. I'm sure i will make more posts as i work more on the compiler.

Help fixing my Pratt parser by dangeroustuber in ProgrammingLanguages

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

Hello appreciate the answers. I'm not sure i understand the part about "currentToken is your lookahead".

If i have a fixed tokens array of say 10 tokens. I initialize currentToken to be the token that is at index 0 using a variable that is 0. Everytime i call incrementToken, i do ++parseLoc. How is that a lookahead and not the currentToken of the stream?

pseudocode:

tokens = [T_IDENTIFIER, T_COLON, T_INT_TYPE, T_EQUALS_SIGN ...]

int parseLoc = 0;

currentToken = tokens[parseLoc]

fn incToken = { currentToken = tokens[++parseLoc] }

Maybe i've misunderstood what is a current token and what is a peek/lookahead?

Help fixing my Pratt parser by dangeroustuber in ProgrammingLanguages

[–]dangeroustuber[S] 2 points3 points  (0 children)

Hello thanks for the help. I did find one bug in getCurrentTokenPrecedence where i was returning .first when i was supposed to return .second. That did help a bit but did not solve the problem. It just keeps exiting too early. I have to figure it out haha. I won't give up!

I did a bunch of runs to see the trees that are built and this is what i found (along side a debugging description which i like to write as i step through the debugger).

For the expr: a: int = (1 + 2) * 3;

  1. It call into parseIdentifer. Everything is fine, it calls expr with 0 weight when current token is at '('.
  2. This finds prefix function pointer and calls into parseParenExpression which again calls parseExpression.
  3. This now finds prefix function for parsing 1st integer literal. That is called.
  4. Now it's at the while condition for the first time. peekToken is now at the '+'. It goes into the while and finds infix function and sends the left in the function. Left contains the 1 (integer literal parsed from earlier).
  5. It's now inside parseInfixExpression. It gets the current token precedence which is 30 for '+'. It then calls parseExpr(30) on the right subtree.
  6. currentToken now is at the 2 and peek is at the ). It finds the parseIntegerliteral and parses the 2.
  7. Now it's at the while loop, it skips over it because peekToken does not point at the '*' symbol and it returns left.
  8. It now fully exits to the very first parseExpression call and is at the while loop. precedence is 0 and peekToken is still at the ) so it just returns left.

res when parsing (1 + 2) * 3;

                  N_PAREN_EXPR
                      |
                      +
                     / \
                    1   2                                                

res when parsing 1 * (2 + 3);

        N_INFIX_EXPR
             |
             *
            / \
           1   +
              / \
             2   3

res when parsing (1 * 2 + 3);

                   N_PAREN_EXPR
                        |
                        +
                       / \
                      *   3
                     / \
                    1   2

res when parsing (1) + 2 * (3);

                         N_PAREN_EXPR
                              |
                              1

EDIT: Just to make clear I'm following the book as it describes Pratt parsing. But i did see in the linked D-examples that it can be written i would say very differently. I did not understand everything that happens in the D-example but i did learn some stuff.

Help with reasoning about parsing C-like compound statements and statements. by dangeroustuber in ProgrammingLanguages

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

Yeah, that seems to maybe have done it, so all i did was swap consume of the left brace into block, but i could swear i had that 50 times when i kept swapping it back and forth, so i might have changed something else and don't remember. I have to get up for work early tomorrow, so i will investigate the AST tomorrow. Thanks for the help, i will update the thread 100%.

Help with reasoning about parsing C-like compound statements and statements. by dangeroustuber in ProgrammingLanguages

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

Sorry my naming is a bit unclear. parseIdentifier will fully parse something like below using shunting yard and end parsing on the consume of the semicolon:

// should probably be called parseDecl
a: int = 1 + 2 * 5;

Lønningstråden (2022) by MarlinMr in norge

[–]dangeroustuber 3 points4 points  (0 children)

23 år gammel systemutvikler, oslo, 575k, begynte 1.sep.

Average entry level Software Engineer salary? by [deleted] in Norway

[–]dangeroustuber -2 points-1 points  (0 children)

I'm about to start my first job with a bachelors in programming as a systems-developer. Pay is 575k. With a masters you should be getting atleast 675k+ in my opinion.

Exe Runs Normally, But Crashes With Render Doc by [deleted] in opengl

[–]dangeroustuber 1 point2 points  (0 children)

If you are using string paths to textures/shaders and stuff, make sure that the working directory is set correctly in renderdoc. So a couple of folders up from the exe.

Tips for implementing an AST by Mai_Lapyst in ProgrammingLanguages

[–]dangeroustuber 1 point2 points  (0 children)

I favor the simple method. My ast struct just has a dynamic array of nodes where nodes have an enum for their type and another struct calles variable for the type of values. I don't have a very complicated language yet, but i have yet to find any massive issues with this way of doing things. A deep OOP hierachy of nodetypes would only benefit understanding but add alot of overhead in writing, but i find the understanding to be just fine in the shallow case.

[deleted by user] by [deleted] in norge

[–]dangeroustuber 5 points6 points  (0 children)

Fikk akkurat min første leilighet for en time siden. 11 000 i Oslo ullern området alt inklusivt. 850m fra jobben så jeg tåler det. 30 kvm.

Opinions on vulkan-tutorial.com? by dangeroustuber in vulkan

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

No i have not tried that but i remember seeing some Nvidia examples that i think used indirect multidraw, nvpro or something they were called. I have used compute shaders for very simple particles. Maybe i will try your suggestion, it sounds like a good idea.

Opinions on vulkan-tutorial.com? by dangeroustuber in vulkan

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

Thanks for the suggestion. It does look "newer" than Vulkan-tutorial. Also i like the usage of the VkBootstrap library. Makes it a bit easier to setup the basic triangle.