Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [compiler]

For reviews of code which implements any part of a compiler - lexing, parsing, code generation and optimization, etc. Also for any plugin for an existing compiler. Don't use this tag for code which is input to a compiler - tag it with the correct language instead.

Filter by
Sorted by
Tagged with
6 votes
2 answers
395 views

I am trying to write a simple tokenizer for a basic arithmetic calculator. Here's the code: ...
user2338150's user avatar
8 votes
1 answer
351 views

Below is a C++ version of a lexer for the Monkey programming language, originally written in Go, as presented in the book Writing An Interpreter In Go. LOC: 262. (Excluding the tests.) Language: Copy ...
Madagascar's user avatar
  • 10.1k
4 votes
1 answer
164 views

Below is a C version of a lexer for the Monkey programming language, originally written in Go, as presented in the book Writing An Interpreter In Go. LOC: 371. (Excluding the tests.) Language: Copy ...
Madagascar's user avatar
  • 10.1k
1 vote
2 answers
147 views

In the process of creating my first toy language, I have created the base grammar for it (which can surely be improved upon, feel free to comment). I am emitting C at the moment. \begin{align} ...
Tsaras's user avatar
  • 157
6 votes
0 answers
305 views

Language: The Brainfuck programming language consists of eight commands: ...
Madagascar's user avatar
  • 10.1k
3 votes
3 answers
455 views

I have a code snippet here about 1D convolution in pure ANSI C code. Question: Is this most optimized C code, or can it be done in a more optimized way? In my ...
euraad's user avatar
  • 183
4 votes
2 answers
150 views

I recently finished cleaning up my code in a compiler/interpreter for a strongly-typed domain-specific language, which makes use of three sorts of types: Compile-time enumerated types: Have one of a ...
P...'s user avatar
  • 141
6 votes
2 answers
246 views

I have a lexer (program that turns source code into tokens) written in Go that I am re-writing in Rust. The lexer should take in a sequence of tokens, generally different special characters, integers, ...
John Allison's user avatar
4 votes
1 answer
471 views

I made an assembler for the "hack" assembly language, here's an example of what it looks like: ...
elonma1234's user avatar
3 votes
1 answer
958 views

Below is my code for building a call-flow graph from a Python abstract syntax tree. I'm not satisfied with it because the algorithm is very complicated. Perhaps much more complicated than it needs to ...
Gaslight Deceive Subvert's user avatar
3 votes
2 answers
395 views

I wrote a very simple VM to get a bit more familiar with Rust. The VM architecture was not the focus, so that I think that can safely ignored. Is my code idiomatic and clean? I felt that I was very ...
xilpex's user avatar
  • 289
4 votes
1 answer
269 views

This program compiles Brainfuck source code to an x86_64 ELF executable. It doesn't rely on any backend, just raw binary stream to a functional executable. In the implementation, each cell holds an 8-...
xiver77's user avatar
  • 419
3 votes
0 answers
112 views

I'm new here, therefore I hope to be clear in this question. Firstly, I want to underline that I'm not a programmer, and I attended only a beginner course in Python, but I like to solve problems ...
Davide Motta's user avatar
4 votes
1 answer
219 views

Now that my new compiler is capable of compiling programs such as the Analog Clock in AEC, I've decided to share the code of that compiler with you, to see what you think about it. File ...
FlatAssembler's user avatar
9 votes
1 answer
346 views

I wanted to make a script that would parse a main file (with int main()) look in its #include "..." local headers, and ...
milanHrabos's user avatar
2 votes
0 answers
49 views

So, I've tried to extend my compiler so that it can target GNU Assembler. And I've made a simple program to demonstrate that. ...
FlatAssembler's user avatar
0 votes
0 answers
95 views

My program , developed with C using win_flex , implements lexical, syntatic and semantic analysis , given defined grammar rules. I would like to know if you any suggestion for improving or ...
Amiram Goldblum's user avatar
3 votes
1 answer
241 views

So, I am trying to make people interested in my compiler project (in the early stages of development) by making some simple and clear programs in my programming language. Here is my implementation of ...
FlatAssembler's user avatar
5 votes
1 answer
752 views

I implemented a compiler that compiles a dialect of BASIC known as SimpleBASIC into Simpletron Machine Language to be run by the Simpletron simulator. I wrote the manual for the SimpleBASIC compiler ...
phillbush's user avatar
  • 864
3 votes
0 answers
93 views

I've made a simple brainfuck compiler, I feel like my code is unreadable and messy, how can I improve it? src/core.clj ...
jacadzaca's user avatar
4 votes
1 answer
498 views

I don't know whether if this is the right place to ask this. I am semi-beginner in C. I always wanted to build my own Programming Language. Here I have built a lexical analyser completely myself. ...
rsonx's user avatar
  • 143
3 votes
0 answers
131 views

I am creating a dialect of ActionScript 3.0 and now have a working verifier, or “symbol solving” verifier. The language upgrades ActionScript 3.0 with few operators, light syntax facilities, numeric ...
user avatar
3 votes
2 answers
1k views

I am writing a parser. To build up the tree, I need to find the correct type for my node based on text from my language input file. Right now, I have a map from a string (the node name) to a factory ...
quintin's user avatar
  • 43
3 votes
1 answer
131 views

A few days ago I started writing my own compiler-like program which has the goal to compile plain text into executable python code. After I let my first version review here, I made huge changes to the ...
TVSuchty's user avatar
  • 605
10 votes
3 answers
3k views

My goal is to write a smaller compiler-like program, which allows me to draw geometric shapes into a 3D Diagram. There is no need for turing-completeness and the program should only be viewed as an ...
TVSuchty's user avatar
  • 605
7 votes
4 answers
2k views

I wrote a simple C++ lexer in python. Although it already works but I kinda feel I didn't follow the pythonic way. Any suggestion for improvements? Sample C++ Code Sample output Here's my code: ...
nitwit's user avatar
  • 501
4 votes
2 answers
2k views

I've been using my Dynamic Exception with C# for quite some time already and it saved me a lot of time. This means, I don't have to create a new exception ...
t3chb0t's user avatar
  • 44.7k
7 votes
2 answers
478 views

I created program that generates brainfuck code that outputs given text. Arguments for the program are input file with the text and ...
DeBos's user avatar
  • 525
12 votes
1 answer
1k views

I have been doing projects from the book The Elements of Computing Systems. Under the scope of project 10 and project 11, I had to implement a compiler for a (toy) programming language called Jack (...
almaveln's user avatar
  • 123
4 votes
2 answers
149 views

When I used to use a PC I was familiar with py2exe, the mac equivalent I saw most people talking about was py2app — which compiles python to .app files, not .exec files. I was familiar with compiling ...
Shui's user avatar
  • 173
17 votes
1 answer
712 views

BrainFreeze This is my implementation of a brainfuck compiler in C. The instruction to build/run the project (GitHub repo) can be found here. I am first converting the brainfuck source to x86 ...
Gnik's user avatar
  • 882
2 votes
0 answers
185 views

I am writing a compiler for esoteric language as one of my first Rust projects. I am using rust-pest to generate a parser. Since I'm new in Rust, code review would be great. Full source code can be ...
Fexolm's user avatar
  • 29
13 votes
1 answer
342 views

After reading this article on writing a Brainfuck interpreter in Haskell and achieving awful performance with it (for example, mandelbrot generating 37.5 minutes on an old Intel Atom powered laptop) I'...
atmostmediocre's user avatar
6 votes
0 answers
434 views

Where it shines FreezeFlame shines in readibility while still maintaining most of the C-like syntax. It also implements a few (Planning on several) operators that are still in testing for other ...
FreezePhoenix's user avatar
5 votes
2 answers
509 views

So this is (I think) a premiere for python. A function that translates brainfuck code to python code. It does a few optimizations (It chains +,...
MegaIng's user avatar
  • 413
3 votes
2 answers
326 views

I have very little experience with cmake, this is really the first time I used it for a project. In the past I used some ...
gruszczy's user avatar
  • 237
4 votes
0 answers
240 views

I've written an implementation of the Hindley-Milner type system as a "Core" language for use in writing compilers of typed functional languages. This is meant to be used as a library by compilers of ...
DylanSp's user avatar
  • 193
12 votes
4 answers
2k views

I'm building a compiler for fun, and this is my first pass at the lexer for it. It should handle all tokens for C99, with the exception of the preprocessor tokens. It's very minimal, only grabbing the ...
User319's user avatar
  • 1,132
7 votes
1 answer
817 views

I'm working through Crafting Interpreters and trying to apply what I've learned in Rust. I've got the lexer working in what feels like a reasonably idiomatic way (hooray!), but I have a feeling it ...
Joe Clay's user avatar
  • 228
0 votes
2 answers
138 views

I'm working on a compiler. During the final stage I will get a collection of Lines. This is the method that takes the Lines and ...
SuperJMN's user avatar
  • 233
6 votes
2 answers
7k views

I'm looking at a task to obfuscate strings in my application like URLs, paths and queries at compile time. This is not for encrypting ...
Ogglas's user avatar
  • 185
3 votes
2 answers
996 views

I'm looking for feedback on my solution to the Tiny Three-Pass Compiler kata on CodeWars. The kata is to implement a compiler for an arithmetic language in three passes - parsing to an AST, constant ...
DylanSp's user avatar
  • 193
4 votes
0 answers
85 views

I would like some reviews of my Type system library in Golang that I am building for a compiler project. Here are external links to the versioned source files, types.go builtins.go The first file: <...
TDk's user avatar
  • 141
6 votes
1 answer
7k views

Sometimes when I write objects for holding data (not real DTOs, no serialization involved) I also create an interface for it. The class that implements it can also perform some null checks. I don't ...
t3chb0t's user avatar
  • 44.7k
2 votes
3 answers
3k views

I often need a simple exception with a meaningful name and some helpful message which usually just looks like this one: ...
t3chb0t's user avatar
  • 44.7k
4 votes
1 answer
217 views

I am attempting to follow the "Let's build a compiler" tutorials, in order to build a basic language compiler for a custom assembly language. Currently the specs of my compiler are: Accepts a ...
Melkor's user avatar
  • 181
7 votes
3 answers
4k views

Roadmap I'm trying to follow usual compiler design: Lexical analysis (1, 2) Syntactical analysis <---- you're here Semantic analysis User input Code generation + execution Background I think I ...
Incomputable's user avatar
  • 9,722
10 votes
1 answer
677 views

I'm trying my hand at developing a compiler and have written a peg.js grammar for a simple programming language. A sneak peak at the grammar: ...
Logarytm Całkowy's user avatar
6 votes
1 answer
250 views

I have posted this question 2 days ago and got amazing feedback on it. Hands back to the keyboard, I believe I took the suggestions into account and improved the classes drastically. In this question,...
downrep_nation's user avatar
14 votes
4 answers
3k views

I'm writing a compiler for a couple of months now, this is the tokenization part of the lexer. I would like a code review to improve my coding style and learn new techniques to pretty up my code and ...
downrep_nation's user avatar