js4vbAuthor: Dave Date: 10.19.25 - 8:08pm Ok..so this weekend I may have gotten a little carried away and gone on an AI fueled coding bender! It all started innocently enough...hey Claude, lets try building a JS AST parser in VB6?! Well it nailed it. Then I was all like, hey..how hard is it to implement and interpreter now that we have AST? And he was all like, thats pretty easy now! So..We did a thing. Should be pretty stable now. I have tested heavily. Compiles as an ActiveX dll and has some example projects to get you started.
The JS/COM wrapping is ridiculous in its own right! You can see more details here. ' Create a JavaScript object interp.Execute "var person = { name: 'John', age: 30, city: 'NYC' };" ' Get it as a VB COM object! Dim person As Object Set person = interp.EvalAsObject("person") ' USE IT LIKE A VB OBJECT! Debug.Print "Name: " & person.name ' "John" Debug.Print "Age: " & person.age ' 30 Debug.Print "City: " & person.city ' "NYC" ' MODIFY IT! person.age = 31 person.Job = "Developer" ' Add new property! Github Repo License: MIT (because we should have had this forever ago!) Dependencies: (all open source)
One other thing worth adding. I think claude was able to nail this so well because javascript is a very public and common example of a scripting language. It has trained on endless js engine code and discussions. Even when claude was hallucinating, it was using almost identical named variables and constants. When we got to areas of custom coding it was must less definitive. Anyway...its interesting what an AI weekend can bring you! Comments: (0) |
About Me More Blogs Main Site
|
|||||||||||||||||||||||||||||||||