Any usable scripting language for PB?

Just starting out? Need help? Post your questions and find answers here.
erion
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Jan 24, 2010 11:12 pm

Any usable scripting language for PB?

Post by erion »

Hi,

I'm currently working on a project which badly needs a scripting language for design and to call functions from the host application (i.e. from the pb compiled program).
I've tried Lua, as it is quite popular and easy to learn, however I'm unable to retrieve any error string upon a syntax/runtime error, as the stack returns only an error code, I assume.
My question is, does anyone know any, possibly painless scripting language which could interface with pb with the following features?
1. Possibly no C-like syntax.
2. Is able to call functions from the host application.
3. Has typeless variables, or as few types as possible
4. Not a requirement, but oop for faster development.
If the language is good enough, I'm willing to sacrifice the no C syntax :)

Any help is appreciated.
Erion
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.

- W. B.

Visit my site, also for PureBasic goodies http://erion.tdrealms.com
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: Any usable scripting language for PB?

Post by Thorium »

There are actualy PB script engines. I remember Operno and PaladiumX.
A search for those words might help you.
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Any usable scripting language for PB?

Post by Zach »

I think I looked at those before, and while they were off to a good start I'm not sure if they are actively maintained which could be a problem when trying to use for more than experimentation.

It really would be nice if we had an easy way to integrate LUA, Python, or Ruby :? Something with no hassles and easy setup..

I know several people have worked on Python includes (wrappers?) so you may want to try searching for that as well.
erion
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Jan 24, 2010 11:12 pm

Re: Any usable scripting language for PB?

Post by erion »

Thanks, I'll have a go at the pb engines and wrappers.
Python, Lua and Ruby would be the best indeed, though they have a really painful API. Especially python, where you have dozens of nested structures and macros, procedures with structure parameters, etc.

Erion
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.

- W. B.

Visit my site, also for PureBasic goodies http://erion.tdrealms.com
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Any usable scripting language for PB?

Post by Zach »

Personally, I loved the time that I spent learning Python.. I didn't learn a whole lot, in terms of using more advanced stuff or anything like that, but for an Object Oriented language it was the most fun I've had, and most progress I ever made learning a language.

Ruby on the other hand, in a lot of ways seems so easy that I'm too stupid to learn it.. I don't know why, but it always frustrates me the way it does a lot of things, and the way some of the syntax is setup.

LUA I've never really played with because it looked a lot more terse as a language, and cryptic to understand. But I know it is used in lots of games and such.

But realistically I'd take any of the 3 above, with Python being my favorite for now.
User avatar
Erich
User
User
Posts: 49
Joined: Thu Sep 30, 2010 9:21 pm

Re: Any usable scripting language for PB?

Post by Erich »

Probably not what you're looking for but you could also take a look at some of the numerous Scheme implementations out there.

Small ones: e.g. SIOD, TinyScheme, Scheme 9 from Empty Space (http://www.t3x.org/index.html) -- the last one is kinda cool, it's super-small and still comes with big number support :D, but you can probably only make sense of it if you buy the accompanying 30$ book.

Bigger extension languages: Elk, Guile

Huge with JiT compiler: Racket

Extensible Scheme to C compilers: Chicken scheme, Stalin (produces C code that is often faster than handcrafted C)

I understand many people don't like LISP syntax but they have one advantage, they allow you to define your own domain-specific language very easily, i.e. you can abstract the interface to your app to a very high-level. Some of them like Racket are also pretty fast, faster than Python and Lua, but I guess only the smaller ones are easy to embed. AFAIK, none of them have been interfaced with PB yet.
"I have never let my schooling interfere with my education." - Mark Twain
xorc1zt
Enthusiast
Enthusiast
Posts: 276
Joined: Sat Jul 09, 2011 7:57 am

Re: Any usable scripting language for PB?

Post by xorc1zt »

actually python is the best overall language you could find. python has everything and a very huge community which do a lot of open works but the main problem is that you will probably need a DLL written with C to interface python with purebasic. Otherwise, Guile is quite good and can compile Emacs Lisp and ECMAScript (Lua support coming soon) but still not widely know. If you want the most simple but still power full, choose Lua. Lua would be my choice for purebasic, the interface is very easy to implement and there are a lot of examples and tools.
User avatar
Derren
Enthusiast
Enthusiast
Posts: 316
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Any usable scripting language for PB?

Post by Derren »

Choosing a scripting language is not enough.
You need a way to interact with the script.
Simply running a script is not enough in most cases (especially in game programming).

Here's a LUA implementation. Unfortunately it hasn't been updated. It's for PB 4.0 and the LUA version is also older.
http://www.realsource.de/index.php/down ... pb-include

I have researched a way to use python with PB. No luck. There's no simple library to interpret python.

And then there's this: http://translate.google.com/translate?h ... 6t%3D21646
User avatar
blueb
Addict
Addict
Posts: 1116
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Any usable scripting language for PB?

Post by blueb »

You may want to search for "Autowin"... a PureBasic scripting language. The source is also included in the ZIP from ts-soft on this site.
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
Derren
Enthusiast
Enthusiast
Posts: 316
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Any usable scripting language for PB?

Post by Derren »

Not sure if this is suitable.
It's like AutoIt. There's no math, no strings, I don't even know if you can share variables.

Here's the command list:

http://www.realsource.de/index.php/down ... 24-autowin

AW_ChangeMatchMode
AW_FindHiddenWindow
AW_ControlClick
AW_ControlDisable
AW_ControlEnable
AW_ControlFocus
AW_ControlGetHandle
AW_ControlGetText
AW_ControlHide
AW_ControlMove
AW_ControlSetText
AW_ControlShow
AW_MouseClick
AW_MouseDown
AW_MouseMove
AW_MouseUp
AW_SendKeys
AW_WinActivate
AW_WinActive
AW_WinClose
AW_WinExists
AW_WinGetProcess
AW_WinGetState
AW_WinGetStateEx
AW_WinGetTitle
AW_WinHandle
AW_WinHideFromTaskBar
AW_WinKill
AW_WinMinimizeAll
AW_WinMinimizeAllUndo
AW_WinMove
AW_WinSetOnTop
AW_WinSetState
AW_WinSetStateEx
AW_WinSetTitle
AW_WinWait
AW_WinWaitActive
AW_WinWaitClose
AW_WinWaitNotActive
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Any usable scripting language for PB?

Post by ts-soft »

The functions in autowin a like autoit, but it is no scripting language, it is a lib for pb users :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
ultralazor
Enthusiast
Enthusiast
Posts: 186
Joined: Sun Jun 27, 2010 9:00 am

Re: Any usable scripting language for PB?

Post by ultralazor »

There is actually a fast way to make your own, that is stable and fast. Make a stack-machine with symbol tables and internal pointers. There is also a way to use bison and flex to generate them in C++.

There are no easy ones. Gamemonkey and Lua are the easiest, and Lua is better cause you can disable modules for different security domains and it has an army of veteran engineers as developers..
so many ideas so little time..
void
Enthusiast
Enthusiast
Posts: 116
Joined: Sat Aug 27, 2011 9:50 pm
Location: Washington, USA

Re: Any usable scripting language for PB?

Post by void »

ultralazor wrote:There is actually a fast way to make your own, that is stable and fast. Make a stack-machine with symbol tables and internal pointers.
This is what I'm doing. I've already got a language+VM capable of integer and floating point math, string manipulation, and recursion.

forth-like languages are very good at rapid DSL work, too, if you aren't challenged by stack-based programming.
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Any usable scripting language for PB?

Post by Zach »

I've never attempt anything like stack-based programming.. I'd probably suck at it, but at the same time I'd be interested in any newbie type links on the subject.
void
Enthusiast
Enthusiast
Posts: 116
Joined: Sat Aug 27, 2011 9:50 pm
Location: Washington, USA

Re: Any usable scripting language for PB?

Post by void »

Zach wrote:I've never attempt anything like stack-based programming.. I'd probably suck at it, but at the same time I'd be interested in any newbie type links on the subject.
This is in assembly, but the principles are pretty easy to follow.
http://git.annexia.org/?p=jonesforth.git;a=tree

The files to read are jonesforth.S and jonesforth.F

They're more documentation than actual code.
Post Reply