A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for converting a source code is to ...
15
votes
3answers
942 views
Reverse Polish Notation Compiler
Description
A reverse polish notation based compiler.
Very small subset of forth
This is a proof of concept level compiler, no optimizations or over/underflow checking
see the embedded POD for more ...
14
votes
3answers
459 views
BF#: Round 2 (Fight!)
So I've completely changed how BrainfuckSharp does things, and added some features. This is obviously a follow up to: Interpreting Brainfuck code to C#, then compiling to a .exe
It now features an ...
12
votes
2answers
294 views
Abstract syntax tree for simple Lisp-like interpreter
A week or so ago, I wrote a binary expression calculator with the hope of better understanding how interpreters and compilers work. In the same vein, I've tried to write a lisp like language ...
11
votes
3answers
352 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 ...
10
votes
3answers
524 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 ...
10
votes
2answers
2k views
+, -, *, /, () expression calculator
In an effort to understand how compilers work, I wrote a simple expression calculator in C#. A CalculatorExpression takes an infix string, converts the infix string ...
9
votes
1answer
147 views
A BrainF*ck-ish compiler in C
-ish because I removed the input functionality from the compiler. And, the compiler does not support nested loops
I've been recently reading up on compilers and how they work. Although this doesn't ...
8
votes
2answers
79 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 ...
7
votes
1answer
73 views
Nothing compiler/interpreter, Part 2
Part 1
I've followed some of the suggestions:
Adding newlines to error messages
Implementing options (I decided to use boost instead of getopt)
Using strerror for fstream failure
Allow multiple ...
6
votes
2answers
128 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 ...
6
votes
2answers
177 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 ...
6
votes
1answer
84 views
Brainfuck to Java converter
Similar to the previous post Brainfuck Interpreter: Slower than a Snail?, it runs BF in java. The only difference is that the converter will convert the BF code into a compilable and fairly readable ...
5
votes
1answer
61 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 ...
5
votes
1answer
160 views
JavaCC Android port User Interface (Activity) class
I have been working on a port of JavaCC for Android. It is mainly an interface. I needed only to modify the original source to redirect output to a TextView. The point of this project is to rekindle ...
5
votes
1answer
37 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:
...
3
votes
2answers
208 views
Lexer for C# source code
This code reads a .cs source file in the \bin folder and parses the C# code in it. The program outputs keywords, identifiers, separators and numerical constants.
How could it be improved?
...
3
votes
1answer
134 views
Runtime compiler performance
I've been playing about with runtime compilation to allow me to get/set runtime property values in C# and so far I have come up with a class.
This allows me to write code like the following which ...
3
votes
1answer
119 views
Simple flex-based lexer
I am trying to learn flex and have created this simple program. The rule for comments works correctly for single line comments such as:
// this is a comment
and ...
2
votes
2answers
89 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?
...
2
votes
1answer
190 views
Using a compiler specified on the command line or automatically detected
Here is part of my build system.
...
2
votes
0answers
59 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 ...
2
votes
0answers
346 views
C++ makefile for CPLEX with environment loading
CPLEX is a solver for mathematical problems made by IBM, and it offers callable C libraries.
My usual project configuration is a main.cpp file will all the important code and a simple cpxmacro.h file ...
1
vote
1answer
50 views
0
votes
1answer
37 views
Compiler for grond, a language-in-the-making
I'm working on a language called grond (see it on GitHub); the compiler is so small it is included in this post.
My gut tells me that this code is awful, but it works. I am hesitant to change things ...