HNHacker News
TopNewBestAskShowJobs

r1chardnl

466 karma · joined August 3, 2021

submissionscomments
r1chardnl··on Muon: GPU Based Electron on a Diet
How does this compare against CEF/WebKit/Electron or any other browser security wise?
r1chardnl··on GET3D: A Generative Model of High Quality 3D Textured Shapes Learned from Images
Management positions replaced by a supervising AI
r1chardnl··on Q1K3 - An homage to Quake in 13kb of JavaScript
Played through till I needed a key then stopped. The first gun's feedback felt quite poor, other than that it's well put together. It felt like Quake that I expected the jump grunt sound to play, albeit I don't know how compressible that would be.
r1chardnl··on Windows 11 available on October 5
Maybe run Windows in a VM with your GPU passed through.
r1chardnl··on Show HN: A work-in-progress C compiler from scratch
Can't edit my original reply anymore, but fair point, I've changed the keyword 'function' in the AST to a function return type instead. There's no error handling done yet to check whether the variable receiving the function return data matches the function return type, but it's on my todo list.

https://github.com/riicchhaarrd/ocean/commit/0618e0810c8d437...

Then again in C it would work aswell if you type casted the types.

  const char *f()
  {
      return (const char*)123;
  }

  int main()
  {
      int i = (int)f();
      return 0;
  }
r1chardnl··on Show HN: A work-in-progress C compiler from scratch
Learning, hobby and fun.

Aspiration to create a language that I would love to use some day.

r1chardnl··on Show HN: A work-in-progress C compiler from scratch
You could use https://en.wikipedia.org/wiki/Yacc

I decided to write my own lexer/parser/compiler it's pretty straightforward.

Sources I use(d) to program this, e.g look at resulting assembly from other compilers or look at how the AST is generated for other languages.

https://en.wikipedia.org/wiki/Recursive_descent_parser

https://en.cppreference.com/w/c/language/operator_precedence

https://godbolt.org/

https://astexplorer.net/

I didn't start writing C yesterday, and most of the things are just stuff I've learned over the years and seeing how other languages work and then just use what I know to try to program in a logical manner.

Also I've written a implementation of a scripting language (compiler and VM) before in similar fashion.

https://github.com/riicchhaarrd/gsc

r1chardnl··on Show HN: A work-in-progress C compiler from scratch
Looks really interesting, thanks for sharing this.

I'm not sure whether I'll incorporate everything from C or just make it compatible with C and behind the scenes do things differently e.g instead of carrying const char */string pointers everywhere always carry the length of said data structure along with it. Or for instance push an additional pointer on the stack for memory zones, where an allocator is always present and knows it's context, sort of like __thiscall with class methods for this->.

r1chardnl··on Show HN: A work-in-progress C compiler from scratch
The main goal at the moment is to create a C compiler, the function keyword there is just a placeholder for the time being. At the moment anything returned is just mov'd into the EAX register and then stored in a local variable if called that way.
r1chardnl··on Show HN: A work-in-progress C compiler from scratch
Thanks, seeing it unfold whilst fixing and adding new features and compiling your program into a executable is really cool.

Motivation is key though.

← PreviousPage 2 of 2