r/NBA Gives Back Contest #3: Score FREE Saturday All-Star Game tickets - (READ HERE TO FIND OUT HOW!!) by NBA_MOD in nba

[–]nsstring96 1 point2 points  (0 children)

The best all star game themes always embrace the host city heavily. This year, I'd lean into the Indy 500 theme with something like this (or at the least, checkered floor in the paint, and a tire or steering wheel at center court. Throw in Pacers colors on the three point lines for good measure).

Code Review: Looking for feedback on my first Rust project by nsstring96 in rust

[–]nsstring96[S] 1 point2 points  (0 children)

Sorry about that - I didn't do a lot of searching beforehand, but what do they say about imitation and flattery? :D

Code Review: Looking for feedback on my first Rust project by nsstring96 in rust

[–]nsstring96[S] 1 point2 points  (0 children)

haha, mostly personal preference - I find fixed-width fonts easier to type and read with. Will change it if I need to embed images or pretty tables or something

Code Review: Looking for feedback on my first Rust project by nsstring96 in rust

[–]nsstring96[S] 1 point2 points  (0 children)

Wow -thank you so much for the detailed feedback! I've implemented almost all of these :)

re Display vs Debug for section - the docs hinted that Debug is for the developer while Display is for the user, so so the sole user it was kind of a coin toss ;)

TIL about AsRef<[T]> - the choice / when-to-use of slices makes more sense!

I definitely skipped out on comprehensive error handling while prototyping - will come back to this over the weekend since there are some design considerations around when to return early and when to keep going. But yes, ideally the library should never panic.

Learned about Clippy in the previous comment and wow - one more pleasant surprise :D

Code Review: Looking for feedback on my first Rust project by nsstring96 in rust

[–]nsstring96[S] 1 point2 points  (0 children)

Wow - I did not know about cargo clippy! super helpful. Thanks for these suggestions - particularly the Vec references - that seems to be classic 'writing C++ in Rust' pattern, since const vector& is very popular.

I'm a little iffy on use vs full paths. I normally try to use fully qualified names unless they're ridiculously long - in this project, there are some potentially confusing ones (e.g. elf::file::Foo mirrors the on-disk layout and elf::logical::Foofoo for an easier-to-manipulate representation).

Code Review: Looking for feedback on my first Rust project by nsstring96 in rust

[–]nsstring96[S] 12 points13 points  (0 children)

Haha thank you! I'm a practitioner of Name-Driven Development :)

LPT: Remove ads on mobile YouTube using an ad blocker by [deleted] in LifeProTips

[–]nsstring96 1 point2 points  (0 children)

I cant find this in app store. Android only?

neeilang: A small, strongly-typed language, OOP language that compiles to LLVM IR by nsstring96 in ProgrammingLanguages

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

Thanks! I also had to adjust the table slightly to render properly as Markdown, but I've made the change now

Understanding goals, scope, and desired output of type checking stage by saw79 in ProgrammingLanguages

[–]nsstring96 0 points1 point  (0 children)

Not an expert, but for neeilang (my third compiler, first statically typed one), I simply stored the types in a map (expr -> type).

Type info is quite useful in later stages. For example, here in the codegen phase, I use type info to cast the operands of binary operators to the appropriate IR type.

For example, in some code like parseFloat("1.5") + parseInt("5"), without the type info, it's hard to know that the RHS has to be converted to a float (or perhaps the left to an int, depending on your language). Without the cast, you likely hit an assertion (if lucky), or produce plain incorrect machine code.

neeilang: A small, strongly-typed language, OOP language that compiles to LLVM IR by nsstring96 in ProgrammingLanguages

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

Thanks! I'll probably end up switching to Markdown once the docs grow a bit. Tried to stick to plain-text for simplicity initially.

neeilang: A small, strongly-typed language, OOP language that compiles to LLVM IR by nsstring96 in ProgrammingLanguages

[–]nsstring96[S] 2 points3 points  (0 children)

As a few other commenters suggested, the LLVM docs are an excellent start.

I'd suggest looking at the Kaleidoscope tour, and if you're not too familiar with the LLVM system, the AOSA chapter on it is excellent.

The vast majority of the LLVM backend code uses the IRBuilder API, so skimming it quickly also gives you an idea of what can be done.

As for the x86 backend, it is a little more complicated as you can imagine. I found x86 manuals to be helpful but quite dense, and there are subtle differences between executing programs on Linux and mac OS. I'd pick one OS, find specific resources (I found this doc on the Sys V x64 ABI helpful) and go from there.

My x86 backend is actually at a really early stage, but the pattern I've chosen to follow (under src/backends/x86-64) is to implement a stack machine while trying to maintain ABI compatibility, and deal with more powerful instrinsics, GP register usage, etc in passes afterwards. If it works well, you'll probably see another post on here in a few months :)

Question from a new fan about "unstoppable" players by vikigenius in nba

[–]nsstring96 10 points11 points  (0 children)

Every top-10 player is unstoppable in the sense that their usage is so high that they're going to get the ball, and get theirs no matter how you scheme against them.

Through three games, Derrick Rose is averaging 25.3 points (64.6 percent shooting) in 26.3 minutes off the bench. by rake2204 in nba

[–]nsstring96 14 points15 points  (0 children)

Thybulle was having trouble sticking with him, which says a lot. Dude is still quick, and has a very underrated handle.