Skip to main content
4 votes
2 answers
172 views

I’m writing a small C compiler front-end in C++17 as a learning project. My parser builds an AST for expressions, and I’m not sure about the best way to handle ownership for child nodes. Here is a ...
Santiago Cepeda's user avatar
Advice
3 votes
5 replies
89 views

If I, for example, create my own strlen as such: unsigned strlen(char *str) { unsigned len = 0; while (*str++) len++; return len; } How would this get converted into an SSA form? I've ...
Avalyn's user avatar
  • 13
0 votes
0 answers
38 views

I am writing an LLVM backend from scratch for a RISC style target architecture, so far I have mostly been able to understand the high level flow of how LLVM IR is converted to MIR, MC and finally to ...
Shobhit's user avatar
  • 133
-3 votes
1 answer
131 views

In 2021, this post here on StackOverflow: How are GCC and g++ bootstrapped? -> Andrius Strikonas' answer explained how GCC can be bootstrapped beginning with a tiny assembler taking just a hex dump ...
einpoklum's user avatar
  • 138k
0 votes
0 answers
84 views

I'm working with WSL2 on Windows, running Ubuntu (and I've tried Arch as well), and I'm encountering some odd behavior with the Linux kernel symbols, specifically around the printk function. It feels ...
Tayler's user avatar
  • 15
1 vote
1 answer
66 views

Consider the following statements 10: a = 1 20: b = a 30: a = 2 40: goto 20 This breaks down into two basic blocks: the entry point # Block 1 10: a = 1 and an infinite loop Block 2 20: b = a 30: a = ...
lordmilko's user avatar
  • 321
1 vote
0 answers
67 views

I'm trying to remove shift reduce errors in a grammar which just recognizes if-else constructs, using the %nonassoc and %prec. I know there are other ways to solve this, but I'm just trying for my own ...
Yoogi Kovendhan's user avatar
0 votes
0 answers
81 views

I am developing a compiler for a custom programming language. The initial parsing is done using Flex and Bison tools. The language supports statement blocks that are implemented in two different ways. ...
Antonis's user avatar
1 vote
0 answers
80 views

Let me give you an example. In a language like Java, we have code like this: class className { } In this example, if className is concatenated to class, and also className is concatenated to {, how ...
Developer's user avatar
1 vote
1 answer
68 views

I am working on building a compiler using Flex/Bison, and tried to utilize a tokens.h file to define the tokens used by the parser and lexer. #ifndef TOKENS_H #define TOKENS_H enum TokenType { ...
Herr_Kobius's user avatar
1 vote
1 answer
108 views

For now I am still using the final release of the original FIRRTL compiler that was archived in 2024. I am using to software compilers going to great lengths to optimize code, performing constant ...
Daniel's user avatar
  • 1,925
1 vote
1 answer
102 views

I'm writing an LALR(1) parser generator, and am getting a bit confused about the use of the GOTO function in creating the parsing table. I've been following the dragon book. The grammar I have been ...
sudgy's user avatar
  • 583
1 vote
1 answer
338 views

I've been messing around with assembly and compilers & have gotten a lot of conflicting information in how I should be using registers, the stack / spill over registers, and to what extent ...
Dak's user avatar
  • 51
1 vote
0 answers
69 views

In the "Compiler Design in C" book, below is a table on a simple expression grammar. According to the below excerpts: Note that the grammar is recursive. For example, Production 2 has ...
yapkm01's user avatar
  • 3,811
1 vote
0 answers
53 views

I am writing a microJava compiler and I am currently implementing class logic. So far I have implemented field logic but I am struggling with method access. The code bellow is working properly (for ...
Nikola Nikolić's user avatar

15 30 50 per page
1
2 3 4 5
392