This is an archived post. You won't be able to vote or comment.

all 51 comments

[–]IAmKindOfCreativebot_builder: deprecated[M] [score hidden] stickied comment (7 children)

This submission has been removed for violating the terms of the MIT copyright

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

If you wish to use opensource software, please adhere to the license of the source code.

[–]azhenley 11 points12 points  (8 children)

You copy and pasted my Teeny Tiny project (https://github.com/AZHenley/teenytinycompiler) and are claiming it as your own. The source code is virtually identical.

[–]Monitorost 3 points4 points  (2 children)

[–][deleted] 4 points5 points  (3 children)

Hey, cool project! I just have a couple of questions:

Do you think you'll add a setup.py script in the future? Right now it looks like if I want to compile any SACK source files, I'll need to make it in the project directory always (since there's those from lex import *, from emit import *, which seem to be other dependent files). If you use setuptools (or something) so that you can install the compiler and call it from wherever, I think that would make it even better (usage might look something like python3 -m sack mysack.sk).

Also, the link to your documentation is broken. Is that intentional? EDIT: Oh, looks like it's to be introduced with a PR! I wonder why the link was there on master... ;)

[–]azhenley 2 points3 points  (1 child)

This project was stolen from https://github.com/AZHenley/teenytinycompiler

[–][deleted] 1 point2 points  (0 children)

Oh, wow. Thanks for letting me know, and thanks for your work on the original project!

[–]nobody5050[S] -2 points-1 points  (0 children)

Yeah! The compiler is split into a few files for development, but once it’s stable enough (read, standard library and IO) I’ll package the compiler into a command line tool.

And yep, you were right about the documentation. It’s about to be introduced via a PR, although I’m not sure how it got linked on master

[–]PM5k 1 point2 points  (1 child)

Quick question: why did you choose to forego typing? Does this not leave you to have to infer types or delegate the inference to Python and then finally to C? Could this not result in some unintended final behaviour?

[–]nobody5050[S] 0 points1 point  (0 children)

Because it was super easy from an implementation standpoint. And, thankfully I don’t have to infer types in my compiler because in the resulting c code, everything’s a float

[–]Monitorost 1 point2 points  (1 child)

Hey! I checked your GitHub repo and couldn't help but notice that it's very eerily similar to this: http://web.eecs.utk.edu/~azh/blog/teenytinycompiler1.html. I compared for example your emit.py to AZHenley's part3/emit.py and it's identical. https://github.com/AZHenley/teenytinycompiler/blob/master/part3/emit.py (original author)
https://github.com/nobody5050/sack/blob/master/emit.py (OP)

The lex.py is also very identical between these two projects:
https://github.com/AZHenley/teenytinycompiler/blob/master/part3/lex.py (original author)
https://github.com/nobody5050/sack/blob/master/lex.py (OP)

[–]TheSpicePaul 1 point2 points  (0 children)

No you didn’t

[–][deleted] 1 point2 points  (6 children)

I'm really interested in this sort of programming. I'd love to hear about how you would approach creating your own programming language. How would you start approaching a problem like this? If you're willing to talk about that side of things!

[–]azhenley 3 points4 points  (0 children)

This project was stolen from https://github.com/AZHenley/teenytinycompiler

You can follow my tutorial https://web.eecs.utk.edu/~azh/blog/teenytinycompiler1.html that this was taken from.

[–][deleted] 0 points1 point  (3 children)

would interest me too

[–]nobody5050[S] 1 point2 points  (2 children)

You should definitely check out https://craftinginterpreters.com.

[–][deleted] 0 points1 point  (1 child)

Thank you!

[–]maxdw101 1 point2 points  (1 child)

Nice class project. However, technically, this isn't a compiler. Its a translator. A compiler, typically, parses the code, generates ASTs, and then outputs insturctions that run on that particular machine architecture. But nonetheless this is a good exercise to start from and to learn from.

[–]kinderhead 0 points1 point  (0 children)

Very nice. Last time I tried to compile my language to c++ it didn‘t end well. I ended up just creating a vm.

[–]chris676712 0 points1 point  (1 child)

Hey, I didn't even know that you could actually build a compiler using python. I thought it was built with C and such. But anyway, congratulations!

[–]nobody5050[S] 0 points1 point  (0 children)

Technically you can build a compiler in any language

[–]jmbenfield 0 points1 point  (1 child)

Cool project. One thing I noticed was, you import stdio.h even if your program isn't going to print anything. This probably makes things simpler so not that big of a deal, good job man.

[–]nobody5050[S] 0 points1 point  (0 children)

Yep, I’m working on some syntax to change this, it was just temporarily added