17
votes
Compiling and throwing simple dynamic exceptions at runtime for JVM
Is there anything that can be simplified or made even cleaner?
Yes, don't invoke the Java compiler at runtime.
From your examples in a comment:
...
17
votes
Heavily limited premature compiler translates text into excecutable python code
I see a number of things that may help you improve your program. Since the existing review covered a lot of good points, this review will cover the parts not already mentioned.
Use the correct form ...
15
votes
Compiler Tokenizer implementation in C#
One small comment about your API.
public void Tokenize()
I would expect a Tokenize method to return a stream (IEnumerable) of ...
15
votes
Accepted
Heavily limited premature compiler translates text into excecutable python code
Allocations can fail
Don't use buffer until we know it's not null. (And no need to multiply by sizeof (char), since that's ...
12
votes
Accepted
Simple C99 Lexer
#ifndef __JMCOMP_LEXER_H__
That is a symbol reserved for use by the implementation. Writing your this in a way that mimics what you see in the compiler-supplied ...
11
votes
Compiler Tokenizer implementation in C#
Your code looks very clean and organized.
Only some comments (without understanding the code in depth)
You would probably use the regex option ...
11
votes
Compiling and throwing simple dynamic exceptions at runtime
Surprising
This is a gross violation of the Principle of Least Surprise. The only possible reaction I could have seeing this in the wild would be, "What the heck?" This is not a normal way of using ...
8
votes
Compiler Tokenizer implementation in C#
A few other things:
cursor += 2; and cursor++; are all over the place in your Tokenizer. ...
8
votes
Accepted
Brainfreeze: A Brainfuck compiler in C
I'm mostly reviewing the code-gen choices, not the style / implementation of the compiler itself.
The compiler itself mostly looks fine in the parts I've skimmed over (looking for how it uses the ...
8
votes
Heavily limited premature compiler translates text into excecutable python code
Another point that hasn't been fleshed out by other reviewers is the generated python code.
list is a built-in function in python - by calling your list ...
7
votes
Brainfuck to x86 Assembly Compiler
Your TargetCodeGenerator's generateAST has multiple abstraction levels embedded into one method.
And it's a long method.
It has all of these details that are pretty complex - when I see ...
7
votes
Accepted
Assembler for CPU
Some simplifications
You can initialize the symbols dictionnary in one instruction:
...
7
votes
Programming Language Source Lexer
Disclaimer
I've NEVER written Rust, used Rust anywhere, or done anything with/about Rust.
However, I do have to say that, what you have there, is extremely easy to read and understand, even for a ...
6
votes
Compiler Tokenizer implementation in C#
You can use verbatim strings to reduce the slash chaos:
{ SyntaxKind.RootOperationToken, new Regex(@"\/\/") },
You can also use IReadOnlyDictionary to ...
6
votes
Accepted
Jack compiler in C
First, you tackled a tough problem and you obviously put a lot of effort into it. The code is well structured. The organization of the code seems fine.
My code contains occasional free() statements,...
6
votes
Lexer for C++ in python
You'll run out of stack memory if you recursively call run() at so many places. You can remove those.
You should consider opening the file with a another context ...
6
votes
Lexer for C++ in python
A lot of could be written in a more functional style. That means that functions return the result of their execution instead of printing it. It makes your code more readable, more composable and ...
6
votes
Accepted
C++ - Lexer for the Monkey Programming Language from the book "Writing An Interpreter In Go"
For someone new to C++ and OOP, your code is pretty good!
Can you really lex one line at a time?
Your Lexer only processes one line at a time, at least that's how ...
5
votes
Python command line tool for compiling py files to exec files on Mac
I recommend that you read PEP 8.
It's advised against doing import os, re. Instead have one line dedicated to each import.
You should have an empty line between ...
5
votes
Accepted
Compiling and throwing simple dynamic exceptions at runtime for JVM
Setting isAccessible to true
You seem to be always settings isAccessible to true. This is only needed if you are accessing ...
5
votes
Accepted
Is this a good way to write a lexer?
Here are a number of things that may help you improve your program.
Don't use define for function-like macros
There is no advantage and considerable disadvantages ...
5
votes
Accepted
Simple BASIC to Simpletron Machine Language compiler in C
C99, assignment-in-conditions
At the risk of sounding like a broken record - I'll make the same recommendations as in Simpletron simulator in C . Consider moving your variable declarations closer to ...
5
votes
Accepted
AEC-to-WebAssembly compiler in C++
How to create an alias for an enum
I see you are declaring 5 constants, like i32, to avoid having to write out a whole ...
5
votes
Extensible typing system for a strongly-typed DSL
General Observations
This is a personal preference, but I really don't like code that overuses macros: it is very hard to debug and maintain.
This question has horizontal scroll bars which is an ...
4
votes
Building abstract syntax tree for markargs
The tests do not belong where you put them.
Imagine me wanting to use your language. I'd expect a standalone compiler executable, and the set of tests - which I can may freely manipulate - driven by ...
4
votes
Accepted
Creating data objects dynamically at runtime from an interface
Cache the type so you don't build it each time. ConcurrentDictionary could do it. Just make a static field to hold the dictionary
...
4
votes
Accepted
Make compiler obfuscate strings
I will not review the code itself but the algorithm you're using. Given that:
Password is available (it's added to the encrypted string).
Algorithm is perfectly clear and available (especially ...
4
votes
Accepted
Assigning names to unnamed labels
A few notes about your code:
Both the inner and outer method are fairly small, and the name of the outer method is already aptly descriptive, so I see no need for a named inner method here. An ...
4
votes
4
votes
Simple C99 Lexer
Include what you use
You use isdigit, isalpha, etc. -- but you haven't included ctype.h or <...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
compiler × 74c × 18
c# × 12
brainfuck × 12
assembly × 10
python × 9
lexical-analysis × 9
java × 8
c++ × 7
performance × 5
parsing × 5
haskell × 4
rust × 4
math-expression-eval × 4
interpreter × 4
beginner × 3
bash × 3
exception × 3
cython × 3
language-design × 3
javascript × 2
python-3.x × 2
c++11 × 2
regex × 2
perl × 2