Skip to content

auxtools debug server: expression evaluation#263

Merged
SpaceManiac merged 3 commits intoSpaceManiac:masterfrom
sohpeach:eval
May 18, 2021
Merged

auxtools debug server: expression evaluation#263
SpaceManiac merged 3 commits intoSpaceManiac:masterfrom
sohpeach:eval

Conversation

@sohpeach
Copy link
Copy Markdown
Contributor

@sohpeach sohpeach commented Mar 28, 2021

The changes for the language server are minimal. This will require shipping version 2.0.0 of the debug server: https://github.com/willox/auxtools/releases/tag/debug-v2.0.0 (use https://github.com/willox/auxtools/releases/tag/v2.1.0 (use https://github.com/willox/auxtools/releases/tag/v2.2.0))

There are plenty of compiler features missing on the debug server's end, but it is definitely more than usable so I want to get it published. I plan on going a lot further this all of this, maybe we'll even have hot loading one day.

Noticeable differences from actual BYOND are:

  1. It only compiles expressions! This means no for loops, no if statements, etc.
  2. It lacks all static typing - the compiler has no access to type definitions and will treat all . accesses as : accesses and ignore the rules of const.
  3. There are no implicit uses of src. This comes from the fact that there is no static typing, so to access a field on src you have to explicitly use src.xyz syntax.
  4. Strings are lame. There is no interpolation support and the escape sequences are super limited too.
  5. Some built-in procs aren't supported, but most are. They'll gracefully error if you try to use them.
  6. No pre-processor.

For other limitations, just view the error list: https://github.com/willox/dmasm/blob/9ba328ef8c4e45c64072198e72c412cd9f685609/src/compiler.rs#L45-L76

tl;dr: relatively well-working debug console eval, watch eval, and conditional breakpoints

@sohpeach
Copy link
Copy Markdown
Contributor Author

I forgot to mention that this would require another proc to be added to code-bases.

/proc/auxtools_expr_stub()
	return

The whole thing works by replacing this proc's bytecode at runtime and then calling it. If you are missing the proc, it just won't work. No crashes or anything.

@sohpeach
Copy link
Copy Markdown
Contributor Author

sohpeach commented Apr 4, 2021

I've released another debug server update since opening this PR, so I'd suggest shipping 2.1.0 instead of 2.0.0.

https://github.com/willox/auxtools/releases/tag/v2.1.0

@sohpeach
Copy link
Copy Markdown
Contributor Author

another one: https://github.com/willox/auxtools/releases/tag/v2.2.0

@SpaceManiac
Copy link
Copy Markdown
Owner

Looked good enough in testing to merge, but here's a few bug reports:

  1. Seems like it's not possible to call verbs - they come out undefined instead
  2. If eval hits a breakpoint, there's a None.unwrap() on debug_server/src/server.rs:1203
  3. "runtime occurred when executing" message has an extra newline at the end

@SpaceManiac SpaceManiac merged commit ced2a7f into SpaceManiac:master May 18, 2021
@SpaceManiac SpaceManiac added this to the suite v1.7 milestone May 19, 2021
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

Successfully merging this pull request may close these issues.

2 participants