Unsolved Scripting language/Compile Qt DLL from Metadata?
-
-
Hi
Besides calling Qt function, what other language constructs do you need?
if/then/else
variables
array
etc ?+1 for python as there is no { } as u ask about
-
@VRonin Python Syntax is appropriate. However, I do not like Python because of its lazy (IMO) lack of basic programming features (unless it has been updated recently to include them). It is terribly inefficient as a result. A classic example is the Python for loop which wastes both time and memory. Technically, they do not exist as Python essentially turns for loops into a "foreach" loop. Creating a collection of integer objects to run a basic counter is insane in my book.
Visual Basic is good too though a bit messy when it comes to OOP. An ojbect oriented version of BASIC that is not Microsoft specific would be a nice candidate. Unfortunately I am not sure that one exists.
@mrjj said in Scripting language/Compile Qt DLL from Metadata?:
Hi
Besides calling Qt function, what other language constructs do you need?
+1 for python as there is no { } as u ask aboutPretty much the things you mentioned plus objects. I need variables to be able to hold an object and perform operations on them. The point is to write scripts to perform the manipulation of objects to be presented. Kind of like Flash's ActionScript.
EDIT: Plus the ability to define functions. The perfect example of the kind of language (syntax wise) is Papyrus Script that is used by Bethesda games. Very, very easy to learn and read even if the modding tools are a pain to use because they don't always work properly.
-
Hi,
If you would like to provide your own DSL, then LLVM might be worth considering.
Here is a presentation about implementing a small DSL with LLVM.
Hope it helps
-
@primem0ver
Hi
Well, most ECMAScript based/inspired script language
Well , what about lua then ?
https://www.lua.org/Or this is also pretty cool
http://www.angelcode.com/angelscript/
But most likely too advanced and c++ like in syntax.There is also the
goodold ( @SGaist , valid point! , its deprecated but very solid )
http://doc.qt.io/qt-5/qtscript-index.html
Which can "cache it"
http://doc.qt.io/qt-5/qscriptprogram.html#detailsI would go with JavaScript as its very easy to integrate and for simple stuff, its pretty basic.
However it does have {} for functions and single threaded. -
I'd avoid QtScript since it has been officially deprecated and removed from the official binary package. You can still built it by hand though but it's not necessarily a good idea for a new project.
-
@mrjj
Java/ECMAScript is too full of "unnecessary" symbols that I refer to in my OP. Personally... I love the C style syntax and if it weren't for the more varied nature of my target population I would be perfectly fine with embedding Qt's version of ECMAScript; however I also recognize that people with a non-programming background may take one look at a file full of braces and other symbols they are not used too and say "I can't learn that!" This is what I am trying to avoid.LUA is a nice language from a syntax perspective but it does not handle object oriented programming well because its only true object type is the "table". I really have no patience for dealing with its convoluted table structures.
@everyone
The problem is that I cannot find a script language that suites my needs. Like I said above... I have research this extensively over a period of time. This is the reason for my OP (original post).Recently I have found a need in another project to create a very simplistic script like "language" for a solution in a .NET program. System.Reflection in .NET makes this pretty easy to do. I could do the same thing I did for this recent project in Qt because of the metadata used by Qt's object system. This gave me the idea of "what if I could somehow use the metadata to make it easier to do linking?" and post my original question. My current on the fly "translation" of the recent script I created does not solve the issue of the need for efficiency in my larger Qt project that could be resolved by either a VM or even better... the ability to compile a DLL based on linking to functions using Qt metadata (which was my original curiosity).
One things that may help you understand the nature of what I am trying to do: Cold Fusion is an ideal language as it uses a VM, it has a basic syntax, AND it is natively embedded into xml (which is where many of the script fragments will be placed). It would be fairly simple to write a "translation" utility that turns script text into Cold Fusion XML directives. Unfortunately it is a proprietary Adobe product. In my experience Adobe products cost way more than they are worth; especially considering the decline of Flash after they bought it from Macromedia and that Flash is their only other script technology.
@SGaist : I have looked into LLVM and scripting languages that use it. Unfortunately, I have already looked into the big lanaguages which already exist on this platform. I am afraid that they don't really suite what I am trying to do very well. I appreciate the link though as it seems to contain some information I was looking for about creating my own language using that particular platform.
-
@primem0ver - have you considered providing your users with a visual workflow editor? For non-programmers, a visual workflow maybe easier to work with. Various products provide such an interface for their less technical users, while also providing a more fully featured programming/scripting language like java script for the more advanced users. Unreal Engine provides Blueprints for users who want to avoid c++ programming: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/
Microsft provides a Workflow Foundation for Windows .NET Applications that I've used before. I've also worked on in-house workflow engines before. You can make them as fully featured or as simplified as you want. The Windows Workflow Foundation basically provides a visual programming language - you can do basically anything and everything that you could do with C#. The in-house one I worked on provided a script activity for advanced functionality, but the rest of the visual blocks provided high-level activities like send an email to a manager for approving a Purchase Request. Or: run a report and email it to me when it completes. Or: update a record in the database. No curly braces required!
-
@iam1me
Thanks for that suggestion. It is a really good one which I may implement. However...@everyone
I think I just thought of a way I may be able to do exactly what I wanted to do when I posted this question. Tell me what you all think. I believe I actually can convert my own script language to a compiled Qt DLL by "cheating." The idea is that I use a parser to convert my symbolic script code into C++ code and then compile the C++ code into a DLL using Qt's command line compiler. If I were to decide on a strongly typed syntax, I could use am1me's suggestion for helping non-programmers not have to worry about types while the programmers should be fine with using types. -
Just one thing: Qt doesn't have any compiler, it's "just" a framework. It will be whatever your platform provides.
-
Huh? Then how does the Qt Creator work? IT compiles stuff doesn't it? Personally I use the plugin for Visual Studio but the documentation says you can compile stuff from Qt Creator.
-
@primem0ver
Creator is an IDE
You can make it work with most compilers.
It calls external tool for compiling.
The compiler is not part of Qt.
( except the mingw on windows. there the compiler is included in the installer)So no, there is no Qt c++ compiler. It will be Visual Studio or mingw or Xcode or gcc or what ever a platform offers. :)