Bos <-> Lua interpreter

Bos <-> Lua interpreter

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Bos <-> Lua interpreter

Post by Forboding Angel »

Is such a thing possible? I'm talking about something that would actively interpret bos into lua unit scripting.

It's already done for FBI to lua, even though that is a much less complicated example.

Is this doable?
Last edited by Forboding Angel on 21 Mar 2012, 05:30, edited 1 time in total.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Bos <-> Lau interpreter

Post by zwzsg »

User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: Bos <-> Lau interpreter

Post by MidKnight »

Forb, you... you even commented in that thread.

...What has become of you, Forb? Have the long outback summers and the seraphic concert nights finally taken their toll? Has the Forboding Angel we knew and loved been reduced to a shadow of his former self, a mostly-the-same Forboding Angel who can't even remember an obscure forum thread from two years ago!?



Oh, rue this day!
:cry:
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Bos <-> Lua interpreter

Post by Forboding Angel »

I do not want a converter. I am talking of a realtime interpreter (a parser if you will), like what is used in base content to parse FBI files.

http://pastebin.com/T8fEDbJJ
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Bos <-> Lua interpreter

Post by Google_Frog »

What does interpreter even mean? Both are already interpreted by the engine.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Bos <-> Lua interpreter

Post by knorke »

With loadstring you can excecute lua code that is stored as a string.
Not sure if that works for unitscripts.
If yes, you could read in the .bos file, do a lot of search&replace (basically what the converter site does), store in a string and run it.

Or wait, make a gadget that parses the .bos file, follows its instruction line by line and uses Spring.UnitScript.CallAsUnit to animate the unit. (Not sure how callins would work?)
What this would be good for, i do not know.
What does interpreter even mean?
It actively interprets. Like, with electrolytes!
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Bos <-> Lua interpreter

Post by Forboding Angel »

Ideally, so that you could use bos or lua and not have to compile either.

Following that notion, you could come up with an active converter to dump a lus script from a bos script.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Bos <-> Lua interpreter

Post by knorke »

I do not want a converter.
an active converter to dump a lus script from a bos script.
:shock: :?:
so that you could use bos or lua and not have to compile either.
you do not need to compile anything if you use lua.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Bos <-> Lua interpreter

Post by Forboding Angel »

The point is, you could just edit bos instead of compiling it. Doesn't seem like too far fetched of an idea.

The end result could be a converter (considering that the end result is bos interpreted to lus, it isn't a big leap), but what I am asking about is an interpreter/parser.

One thing troubles me though. It seems like if this were more or less trivial, it would have already been done.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Bos <-> Lua interpreter

Post by Beherith »

Im not sure I understand the why here. Why is compiling bos such a bad thing? it compiles fast, the compiler is pretty smart and filters out a lot of mistakes that would require launching the game first to check for.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Bos <-> Lua interpreter

Post by smoth »

why not just use a proper lua unit script?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Bos <-> Lua interpreter

Post by zwzsg »

Writing a parser from scratch would seem to me like a hard and long task.

Hopefully there's already someone lese over the great wild internet who already coded some sort of C code parser in Lua, then made it free and open source.

If you'd grab it and were able to understand and modify it, that already would be a good starting point.

You would then have to add the support of a couple bos specific syntax (move, turn, signal, etc...), and tweak it a little.

Then you would have to code how to translate the parser output into Lua unit script.

Since you want a fully automatic tool, unlike CarRepairer bos2lua which outputs a draft requiring manual cleaning, then you'd have to also perform tedious and arduous debugging.

So unless there's a super clever dev getting super bored for weeks, I don't see that happening.

The benefit/work ratio seem stupidly low to me.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Bos <-> Lua interpreter

Post by FLOZi »

1. Remove all cob support from engine

2. Execute anyone who 'writes bos in lua'

3. See how many people take this post seriously
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Bos <-> Lua interpreter

Post by Forboding Angel »

You guys are aware that I asked this out of curiosity, right?
Post Reply

Return to “Lua Scripts”