Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modaccent long type conversation errors #7

Open
HexDecimal opened this issue Aug 15, 2024 · 12 comments
Open

modaccent long type conversation errors #7

HexDecimal opened this issue Aug 15, 2024 · 12 comments

Comments

@HexDecimal
Copy link
Collaborator

I've noticed a ton of conversion errors in the modaccent sources. These sources seem to insist on casting long types to long* pointers and back again. On most x64 systems the pointer will be larger than the integer.

This can generally be fixed by replacing long with intptr_t.

@rmtew
Copy link
Owner

rmtew commented Aug 15, 2024

Currently playing with this.

@rmtew
Copy link
Owner

rmtew commented Aug 15, 2024

This however, is fixing the output of generated code.. better would be to regenerate them with better tools, but whether we had the source files I do not know.

@HexDecimal
Copy link
Collaborator Author

Generated code explains is why it looks so terrible. I'm not sure where it's generated from.

@rmtew
Copy link
Owner

rmtew commented Aug 15, 2024

Possibly it came wholesale as part of the ACCENT distribution and was used with a bit of wrapping by Julian. Possibly he lexed and bisoned it together ACCENT. Either way it is what it is.

@rmtew
Copy link
Owner

rmtew commented Aug 15, 2024

I think we have our answer :-)

https://github.com/viegasfh/accent/tree/master/accent

@rmtew
Copy link
Owner

rmtew commented Aug 15, 2024

I think the right path forward is working out how to build a modern accent. I've fixed the intptr_t occurences and it goes from crashing to existing with some maxint looking exit code.

@rmtew
Copy link
Owner

rmtew commented Aug 15, 2024

  1. Get some linux adjacent environment with modern flex and bison.
  2. Compile Gentle-97.
  3. Edit and run accent build script.

@rmtew
Copy link
Owner

rmtew commented Aug 16, 2024

Rerunning accent or gentle fixes none of the core problems here.

  • Gentle and accent have the long * baked in.
  • Functions are called without definitions, both in the same file and externally. Arguments default to int and get clipped if actually 64 bit.

This is the same whether using the new cleaner accent output or the existing modaccent code. At some point only compiling it as 32-bit and running that, ignoring all the warnings and so on seems like the reasonable outcome.

@HexDecimal
Copy link
Collaborator Author

It's difficult to find information on this. Which parts of the project rely on this compiler? Is this for the files in lib/? Or for the ones in lang/?

@HexDecimal
Copy link
Collaborator Author

HexDecimal commented Aug 16, 2024

Grammar.acc, the .acc is for ACCENT. So now I need to figure out what Tokens.lex is. I somewhat understand, but it's very convoluted.

@rmtew
Copy link
Owner

rmtew commented Aug 16, 2024

Here's me trying to write it as simply as possible. As it is convoluted this might be wrong.

  1. We run flex on Tokens.lex to get the IncursionScript lexer code called by the accent parser/compiler.
  2. We run modaccent on Grammar.acc to get the IncursionScript parser/compiler.
  3. We build this into Incursion.exe debug builds.
  4. We execute a debug Incursion.exe with -compile to create the module.

I've never bothered looking at this whole side of things outside of bug fixing in the grammar because IMO it is a time sink. What I would personally do is refactor the module compiling out into a separate executable and remove it from Incursion.exe. And continue to ignore this whole part of it and focus time on user accessible things.

@HexDecimal
Copy link
Collaborator Author

It does look like messing with this could become a time sink. I should just be happy that the automated builds actually work right now.

@HexDecimal HexDecimal changed the title modaccent type conversation errors modaccent long type conversation errors Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants