Hello Josh,
I registered an account just to ask this question: how is LTSL written? Did you write the parser, interpreter etc from scratch in C++, or did you use good old 3rd party tools like bison, flex etc. to parse LTSL? I'm pretty sure it is not mentioned in the dev logs.
Thanks alot!
Post
Sat Aug 02, 2014 5:54 am
#2
Re: How is LTSL written?
well, reading the devlogs helps
everything is written from the ground up, at least josh never mentioned any 3rd party code
everything is written from the ground up, at least josh never mentioned any 3rd party code
Post
Sat Aug 02, 2014 12:53 pm
#3
Re: How is LTSL written?
Welcome to the forums!
If he mentioned using a tool, I missed it too. But one nice property of Lisp-like languages is that they're very easy to interpret. The source code is already an abstract syntax tree! I wrote my own small Lisp in Python maybe six months ago, and had it working in a single Friday afternoon with a few last changes the following Sunday, made while I was using it to develop something else. A few things were in my favor: circumstances let me skip the lexing step, it's interpreted instead of compiled to something else, and it doesn't support macros. But writing a simple Lisp compiler from scratch with all the minimum special forms is completely feasible in just a couple days!
It's something people should try, I think. I learned a ton, and it's motivated me to add Common Lisp to my toolset.
If he mentioned using a tool, I missed it too. But one nice property of Lisp-like languages is that they're very easy to interpret. The source code is already an abstract syntax tree! I wrote my own small Lisp in Python maybe six months ago, and had it working in a single Friday afternoon with a few last changes the following Sunday, made while I was using it to develop something else. A few things were in my favor: circumstances let me skip the lexing step, it's interpreted instead of compiled to something else, and it doesn't support macros. But writing a simple Lisp compiler from scratch with all the minimum special forms is completely feasible in just a couple days!
It's something people should try, I think. I learned a ton, and it's motivated me to add Common Lisp to my toolset.
Post
Sun Aug 03, 2014 1:49 pm
#4
Re: How is LTSL written?
I asked him in IRC while he was uploading the update. I also assumed he was using flex/bison (since thats the only way Im familiar with doing syntactic/semantic analysis), but he said that the LT engine itself was doing all the heavy lifting, which kind of blew my mind.
Post
Sun Aug 03, 2014 2:03 pm
#5
Re: How is LTSL written?
thanks for your answers!
For me this is a coding miracle. At university you need one whole semester just to learn how to use flex and bison. And Josh simply hammers it down in one or two weeks (just besides everything else he does) I just want to know where the cheat is. Maybe he designed the syntax in a way so compiling it is not a real issue?
One more question remains: is an LTSL script parsed every time a new object is created, or does Limit Theory produce some binary or intermediate code for every LTSL-Script?
For me this is a coding miracle. At university you need one whole semester just to learn how to use flex and bison. And Josh simply hammers it down in one or two weeks (just besides everything else he does) I just want to know where the cheat is. Maybe he designed the syntax in a way so compiling it is not a real issue?
One more question remains: is an LTSL script parsed every time a new object is created, or does Limit Theory produce some binary or intermediate code for every LTSL-Script?
Post
Sun Aug 03, 2014 2:24 pm
#6
That way, in Dev Update #19, you can see that as soon as he saves the change for the LTSL script, the engine updates itself immediately.
He also mentioned previously that having hundreds of individual script files could slow down the engine, but that's only at the extreme end of things.
Re: How is LTSL written?
The way Josh explains it is that LTSL scripts are periodically polled.Kazmirzak wrote:
One more question remains: is an LTSL script parsed every time a new object is created, or does Limit Theory produce some binary or intermediate code for every LTSL-Script?
That way, in Dev Update #19, you can see that as soon as he saves the change for the LTSL script, the engine updates itself immediately.
He also mentioned previously that having hundreds of individual script files could slow down the engine, but that's only at the extreme end of things.
Post
Mon Aug 04, 2014 1:16 am
#7
It's the smart thing to do, if you're relatively sure you won't be changing a script during play.
Re: How is LTSL written?
If it ever gets to that, I'm sure Josh will add a parameter to allow a script to give itself a lower polling priority.FormalMoss wrote:He also mentioned previously that having hundreds of individual script files could slow down the engine, but that's only at the extreme end of things.
It's the smart thing to do, if you're relatively sure you won't be changing a script during play.
Beware of he who would deny you access to information, for in his heart he dreams himself your master.
Post
Mon Aug 04, 2014 2:10 am
#8
Re: How is LTSL written?
He gets most of the LTSL from a large arcane book past down to him by the coding wizards of the long forgotten original Elder Council. Limit Theory is a kind of initiation test Josh is undertaking to gain admittance to their hallowed and august ranks.
I think he may get a pass but it depends on how he handles the content section of the test.
I think he may get a pass but it depends on how he handles the content section of the test.
Post
Mon Aug 04, 2014 7:24 am
#9
Re: How is LTSL written?
The ancient coding wizards! How could I forget about them!
Its so crystal clear now:
OMG it all makes sense now. Thanks Victor!
P.S. Josh... no kidding... you wrote parser and compiler and interpreter for a complete language just by hand... in a week?
Its so crystal clear now:
Spoiler: SHOW
P.S. Josh... no kidding... you wrote parser and compiler and interpreter for a complete language just by hand... in a week?
Post
Mon Aug 04, 2014 8:40 am
#10
Re: How is LTSL written?
Too bad that the maximum light-speed delay between earth and mars ~22 minutes is...
Theory: busted!
Theory: busted!
Post
Mon Aug 04, 2014 10:35 am
#11
Oh! And take no notice of what Cornflakes said. He thinks in human terms, he has little knowledge of the advanced devices the original EC possess. The ranks of the Council are filled with those supremely gifted individuals who are true Masters in a bewilderingly diverse collection of disciplines. Coding forms a small but significant part of the whole.
Josh may tell us more if he feels inclined to do so but the true EC jealously guard their privacy. They may decide he has revealed enough.
Re: How is LTSL written?
I forgot to welcome you to the LT forums, Kazmirzak. Sorry about that. I'm sure you will enjoy your time here.Kazmirzak wrote:OMG it all makes sense now. Thanks Victor!
Oh! And take no notice of what Cornflakes said. He thinks in human terms, he has little knowledge of the advanced devices the original EC possess. The ranks of the Council are filled with those supremely gifted individuals who are true Masters in a bewilderingly diverse collection of disciplines. Coding forms a small but significant part of the whole.
Josh may tell us more if he feels inclined to do so but the true EC jealously guard their privacy. They may decide he has revealed enough.
Post
Sun Sep 21, 2014 2:29 am
#12
Re: How is LTSL written?
Last viewtopic.php?f=12&t=3521&sid=e8bfe77b5 ... 77b#p64143 devlog:
Ha! Now we know that Josh knows about the "regular world" of bison and flex, which uses "grammars" to describe a language. And now we also know he would rather hacks his own parser down in some plain C++ than use these crappy tools.Indeed, in the regular world of parsing massive languages with ambiguous grammars and so forth, it might not be such a simple thing. In the simple world of LTSL string lists, it took me one hour to have full-blown infix operators with correct precedence implemented in the language. The code that implements it is about 80 lines of C++. Simplicity pays off once again!
@Josh: Any source code snippets for those guys that do like these dev logs? We are right herePS ~ I know, you're tired of hearing about LTSL [...]
Post
Sun Sep 21, 2014 10:53 am
#13
In Windows:
http://msdn.microsoft.com/en-gb/library ... 85%29.aspx
In Linux, the inotify system might be useful (http://en.wikipedia.org/wiki/Inotify)
Re: How is LTSL written?
Better yet, use some sort of surveillance on the file that notifies LT of someone writing to the file. Then reload it.Katorone wrote:If it ever gets to that, I'm sure Josh will add a parameter to allow a script to give itself a lower polling priority.FormalMoss wrote:He also mentioned previously that having hundreds of individual script files could slow down the engine, but that's only at the extreme end of things.
It's the smart thing to do, if you're relatively sure you won't be changing a script during play.
In Windows:
http://msdn.microsoft.com/en-gb/library ... 85%29.aspx
In Linux, the inotify system might be useful (http://en.wikipedia.org/wiki/Inotify)
Post
Sun Sep 21, 2014 11:26 am
#14
Re: How is LTSL written?
This is almost certainly already the case, the game watching for changes to the script files or folders.
Being slow from running many scripts wouldn't be related to them being changed though, it would be due to the pilling on of extra conditions for game logic and objects.
Being slow from running many scripts wouldn't be related to them being changed though, it would be due to the pilling on of extra conditions for game logic and objects.
woops, my bad, everything & anything actually means specific and conformed
Post
Mon Oct 20, 2014 3:50 am
#15
Re: How is LTSL written?
Writing a small interpreted scripting language isn't as hard as it sounds. I'm sure doing it from scratch is more fun than wrestling with a bison.^^ But the way he added not only a hot-loading custom scripting engine but also a full fledged, meticulously polished code editor that seamlessly integrates with the game app blows me away. Is that custom written too? It looks so beautiful!
Last edited by lithander on Mon Oct 20, 2014 4:04 am, edited 1 time in total.