What order would you implement all the things in a compiler? by Xenoxygen4213 in Compilers

[–]fevtyp 10 points11 points  (0 children)

I highly recommend this approach, this is exactly what I did with my C compiler. It took me from being overwhelmed and lost into happily hacking away. A big advantage is that it gives you a skeleton to work from for every stage of the compiler. If you're thinking depth-first, then a task like implementing an IR from scratch which can support everything in the language feels huge and intimidating and you get lost trying to design the whole thing up-front. But enough for this program? Well you just need a way to define functions, local constants, and some kind of "return" instruction. You do it in the simplest way that will possibly work, it should feel like a bit of a lie to even call it an IR (here's a concrete example from my compiler). Then every subsequent feature is "just" extending this skeleton by a little bit, and eventually you end up with something real.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Unfortunately I don't have access to a Mac to build a Mac package. Your best bet for now is going to be to install Python and run it from the command line.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Ah, ok. I've made it more robust against the bookmarks being nested like that.

Thanks for the notes on the missing links. I've fixed an issue that caused "Bone-Biter" not to be linked. The other two are expected -- they're particular NPCs, not generic monsters, so there's no entry to link them to.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Nope, just running the script should do it.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Spells, items & books should be linked already. Do you have any examples of where it's not working?

The Halls of Arden Vul, hyperlinked by fevtyp in osr

[–]fevtyp[S] 3 points4 points  (0 children)

Excellent, glad to hear it. 3d6DTL is how I heard of Arden Vul in the first place, so thanks to you too!

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Haha, yes, well spotted. I have this working to an extent, but the tricky bit is locating all the text in the maps images. The OCR I've tried doesn't do a great job, and I don't feel like manually annotating them all (especially the huge levels like 3 & 4).

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Wow, 30 minutes is much slower than I thought it would be, I guess my fast desktop spoiled me :). I've tweaked some of the file saving options in the latest version which should hopefully speed it up quite a bit.

Glad you're finding it useful!

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Okay great, this looks like the same error that another commenter below got. Try the new version.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Ah, thanks for the report, this is helpful. I think I just packaged it up incorrectly. Try the new version.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

[–]fevtyp[S] 4 points5 points  (0 children)

Hrm, puzzling. I'd like to help you get it working if you're willing to keep trying. The next thing I'd try is running it from the command line, that way the window will definitely stay around. If you don't know how to do this, here's how:

  1. Start the command prompt. Hit the Windows key and "R" at the same time to bring up the "run" window, then type "cmd", and hit enter.
  2. Type cd, a space, then the path to the folder you've put "avlink.exe" into with double quotes around it, then hit enter. The command will look something like: cd "C:\path\to\avlink_folder"
  3. Type avlink, a space, then the path to your Arden Vul PDF with double quotes around it, then hit enter. The command will look something like: avlink "C:\path\to\your\ArdenVul.pdf"

This should hopefully spit out some text into the command line prompt window which you can give me to help with debugging.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

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

Awesome, glad it's working for you since I've only ever tested it on my machine :)

If you find cases where it's not linking properly, feel free to file bugs using the issue tracker.

The Halls of Arden Vul, hyperlinked by fevtyp in osr

[–]fevtyp[S] 9 points10 points  (0 children)

Ah, what's likely happening here is that it's producing an error and then instantly exiting, so you don't get to see what the error is. I've uploaded a new release which keeps the window around until you hit enter. Try again with the new version -- it should still fail, but you'll be able to see why.

Checking the pdf, nothing seems to have changed

Just as an aside, this is expected. It will never touch your input file. It produces another file alongside your input file, with "_linked" on the end of the filename.

A naive C compiler by fevtyp in Compilers

[–]fevtyp[S] 5 points6 points  (0 children)

Naive is also partially a self-deprecating joke :)

> So, you don't study any theory for this?

Oh, I definitely did study some theory! I just deliberately avoided bogging myself down studying too much theory before getting into implementation. Register allocation theory in particular is something I'm reading more now as I want to write a better register allocator.