Skip to main content

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
7 votes
3 answers
4k views

Building abstract syntax tree for markargs

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,504
5 votes
0 answers
224 views

tbf - An Optimizing Brainfuck Interpreter and Transpiler in C

Language: The Brainfuck programming language consists of eight commands: ...
Harith's user avatar
  • 9,080
2 votes
3 answers
2k views

Compiling and throwing simple dynamic exceptions at runtime

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.3k
40 votes
2 answers
2k views

Brainfuck to x86 Assembly Compiler

After my Brainfuck Interpreter written in x86 Assembly I decided that it was time to get to the next step, writing a Brainfuck Compiler in Java that generates x86 Assembly and compiles that to an ...
skiwi's user avatar
  • 10.6k
14 votes
4 answers
3k views

Compiler Tokenizer implementation in C#

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
14 votes
3 answers
1k views

Interpreting Brainfuck code to C#, then compiling to a .exe

This is a C# programme to convert Brainfuck to C#, then convert that C# to a .exe. So basically, it's a Brainfuck to Windows exe file converter/compiler. This requires any of: .NET 2.0 in C:\Windows\...
Der Kommissar's user avatar
11 votes
3 answers
5k views

Fastest possible text template for repeated use?

While reviewing Sending templatized e-mail to a million contacts, I wrote this implementation to illustrate an alternate approach. It is designed to be the fastest possible way to generate templated ...
200_success's user avatar
10 votes
0 answers
1k views

Cyther: The Cross Platform Cython/Python Compiler (Take 2)

I recently posted an earlier version of this code on Code Review, and now with the given suggestions and many other improvements, I am back. I included the description of exactly what Cyther is ...
Nick Pandolfi's user avatar
10 votes
3 answers
3k views

Heavily limited premature compiler translates text into excecutable python code

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
  • 595
8 votes
2 answers
298 views

Compiler for a minimal LISP dialect to run on the Java Virtual Machine

As the title states, this is a compiler written in C with a ruby build script that translates a minimal LISP dialect and spits out an executable jar file. I designed this LISP dialect and named it ...
user avatar
7 votes
2 answers
3k views

Cyther: The Cross Platform Cython/Python Compiler

The newer version of this question is located here: Cyther: The Cross Platform Cython/Python Compiler (Take 2) I am currently writing a Python library (soon to be published)that automatically compiles ...
Nick Pandolfi's user avatar
7 votes
2 answers
92 views

Pseudoportable C script pattern - follow-up

See the initial/previous iteration. I have rewritten the script following the answer of @200_success. Now it looks like this: ...
coderodde's user avatar
  • 28.7k
6 votes
1 answer
88 views

Pseudoportable C script pattern

(See the next iteration.) From time to time, while working with a command line in *nix family of operating systems, we have to write those scripts doing a rather specific task. Usually we use ...
coderodde's user avatar
  • 28.7k
6 votes
2 answers
321 views

Brainf*ck to NASM converter written in C

I have made a very simple Brainfuck to NASM converter, that is usable for practically all programs. It has one trivial optimisation (to subsitute ADD for ...
user avatar
4 votes
2 answers
178 views

Build script for an operating system written in C++

I recently started following the James M Kernel Dev tutorials and was able to create an operating system in C++. Here is the source on GitHub. I have a couple of questions: Is my coding style ok? ...
aswin mohan's user avatar
4 votes
1 answer
109 views

C99 - Lexer for the Monkey Programming Language from the book "Writing An Interpreter In Go"

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 ...
Harith's user avatar
  • 9,080
4 votes
1 answer
400 views

Assembler made in assembly

I made an assembler for the "hack" assembly language, here's an example of what it looks like: ...
elonma1234's user avatar
4 votes
2 answers
2k views

Compiling and throwing simple dynamic exceptions at runtime for JVM

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.3k
2 votes
0 answers
69 views

implementing lexical, syntatic and semantic analysis

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