Search the Community
Showing results for tags 'script'.
-
I would like to present one of my latest projects, a port of the Gold Parser Engine to LabVIEW. It was not easy, I needed More advanced evaluation than the Built in LabVIEW functions could offer, so I found the Gold parser engine for Java and VB, and yes i could use the .net but I couldn't get it to work well with reentrant calls to parse multiple things in parallel. So I put this together, I would like to polish it with the LV community, And Make it work even faster than it is already. I would like to thank, Devin Cook and Ralph Iden, for their excellent work on the previous Engines. In case you're not familiar with Gold: GOLD is a free parsing system that you can use to develop your own programming languages, scripting languages and interpreters. It strives to be a development tool that can be used with numerous programming languages and on multiple platforms. I use it mostly to build AST out of strings of text that represent short snippets of code. The Source comes with an Top level example of how a recursive evaluator can be implemented. But it can be used for many LabVIEW things including a 100% native XML parser, 100% native Scripting language... and the idea is that its native so that's nice. Performance: I haven't tested long source strings for performance but currently it is working really quite quickly. Sub milliseconds for the numerical evaluation example. LabVIEW can be really sneaky making extra copies when you don't really need them. I have tried to do somethings to increase performance more. Alot of the items in the parsing VI are subroutines. And I have added Swap Values as a common performance tool. It is really cool. especially when working with class private data that doesn't deserve an in class function. eg. Tokens contain other tokens that can be evaluated recursively, however it doesn't make sense to put the eval function in the token class. As AristosQueue posted here http://forums.ni.com/t5/LabVIEW-Idea-Exchange/New-in-place-element-structure-option-class-property-node-read/idc-p/2515866#M24026 After creating a grammar This example uses Devin Cook's Operator Precedence example. As you can see a string goes in and a number comes out. Parser engine has an application to test and verify grammars. This engine only except egt format. The above grammar has 15 symbols. I think of content as leaves on a AST (abstract syntax tree) and Nonterminals as Branches that have more leaves. Productions are a list of how each NonTerminal can be configured I like to think of it as a list of cases to handle. It turns out that this makes a pretty simple recursive evaluation scheme If the Token is Content I see what type by getting the table index and using a typedef with all of them listed. In the case of an integer i get the value from the string and return it. However if the Token is a NonTerminal, It can be handled by Sending the Tokens contained by the token into the recursive function and using the values. You can see that the Production: <Muiti Exp> ::= <Multi Exp> '/' <Negate Exp> Contains 3 tokens. I want to evaluate the Value associated with the <Multi Exp> so i get the sub token at index 0 and <Negate Exp> at index 2. You can find the Code here: https://decibel.ni.com/content/docs/DOC-41064
-
Hi all, Any thoughts on the simplest way to trigger a LabVIEW event using an external script in Windows? I want to be able to poke my LabVIEW application and kick off a predefined code block. No need to pass any information/message. I'm looking for something very passive, unlike, for example, a listening TCP socket. Thanks!
-
During a presentation at NI Week, sorry can't remember which one exactly, the presenter suggested that the "Mark Balla Tool" was a great piece of IDE support code to have. This code was a utility VI or VIs that was said to be available on the code repository. I can't seem to find it. Can anyone point me in the correct direction? Thanks WireWarrior
- 10 replies
-
- mark balla
- niweek
-
(and 3 more)
Tagged with: