parser generator

2023-05-22 Thread dPixie
I tried to try it out, but ... 😊 Hopefully it's just something I'm doing wrong and an easy fix. Looks like a good DSL for lexer/parser generation otherwise.

Can't import compiler/* anymore

2023-05-12 Thread dPixie
@Araq what is the correct way to handle a Nim project that needs access to the compiler library files going forward? Since including a Nimscript runner in your binary requires it (unless I'm mistaken) it would make sense that it was part of the distribution of Nim std, or a separate library as b

Can't import compiler/* anymore

2023-05-11 Thread dPixie
Thanks @ElegantBeef and @pietroppeter. I did see the path option while researching this, but since they folded the `compiler` package into `nim` I assumed it would be reachable through that package now - guess the cake is a lie yet again :D The `"$nim"/compiler/[ ... ]` works. Thanks for helpin

Can't import compiler/* anymore

2023-05-10 Thread dPixie
I did a search in the forums, Github issues and Google but I couldn't find any reference to this problem: I have a Nim project that started out in Nim 1.4 or so that I have upgraded over the years to the latest Nim, currently on 1.6.12. The project needs access to som of the compiler internals

Passing JsonNode from Nimscript to host proc

2021-12-17 Thread dPixie
I looked at your code quite a lot when I did my implementation. If you had had the new version back then I would probably have used it, but at this point I'm pretty much where I need to be with my own implementation so it makes less sense to replace it. But I will pilfer more ideas from your ne

Passing JsonNode from Nimscript to host proc

2021-09-29 Thread dPixie
That worked out well. A bit of a hassle to do all the manual translation, but the resulting client API is clean at least so I'm fine with it :)

Errors in VM code called from Nimscript is hidden

2021-09-29 Thread dPixie
Maybe I'm doing something wrong but when I expose code from my main program to the scripts, via `interpreter.implementRoutine`, and the native code has an error, that error is eaten on the way and I just get a general script error from the call site inside the nimscript. I can see why this woul

Passing JsonNode from Nimscript to host proc

2021-09-10 Thread dPixie
Would you suggest that I marshal and unmarshal via string instead? I mean it is straightforward, but it takes a lot of boilerplate code on both sides. I don't mind the boilerplate on the host side, but the script side I would like to keep as clean as possible ... Can you do type overloading on

Passing JsonNode from Nimscript to host proc

2021-09-10 Thread dPixie
Could I for example consider VMArgs as just bits and tell Nim that I want it to cast bit x..^1 as a JsonNode?

Passing JsonNode from Nimscript to host proc

2021-09-10 Thread dPixie
Hi @araq. Yes that is ofc one way to do it :) In fact that was basically what I was doing, I had ´setInContext( "some.dot.path", $node )´ in the script call, `proc setInContext*( path: string, value: string ) = discard` in the host function declaration and `let value = args.getString( 1 )` in th

Passing JsonNode from Nimscript to host proc

2021-09-09 Thread dPixie
I'm trying to pass a JsonNode from my script into the compiled program. I can get it to work by marshalling the data and unmarshalling on the other side, but if I switch to the strategy of getting a PNode instead of a discreet value, like with VMArgs.getStr etc, I can't then get Nim to correctly

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
Yes, that was my conclusion as well (see above), but I'm very confused why this wouldn't result in a warning at compile time :) Generally not something you want to do, and - as noted - can lead to hard to find bugs (if you are not aware) ...

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
@Araq I made a repo for the project, it was on my todo list for this week anyway. You can find it on a branch with the broken code here: If you rename `global_state` to `state` it works ... I'd love to know why :) Disclaimer: First Nim pro

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
Tested renaming the var to globalState instead, just to rule out the symbol lookup problem I suggested above - still got the same error. So it wasn't that.

Is "global_state" a special name in Nim's internals?

2021-02-11 Thread dPixie
Could there be an issue where the declared variable got exported to the symbol table as literally "global_state" and all the call sites correctly looked for "globalState"? It's the only thing I could think of that would explain it. I did have it exported :) But it was one of the first things I c

Is "global_state" a special name in Nim's internals?

2021-02-10 Thread dPixie
Hi. I lost half a day to a very peculiar problem that I can't even figure out after I solved it. I have a minimal shared state object in my project: # state.nim import tables import types/config import types/config/init type State* = ref object