integrating Syntax parser in LUA

Started by
2 comments, last by GameDev.net 19 years, 4 months ago
Hi all! I'm starting to write a scripting system for a game I work on. I've been reading alot about LUA, and decided it would make my game and user interaction much flexiable. It's really great to keep scenarios in independent files. But, I have a few wonders and questions: 1) LUA is all about interperting the software, right? it's dynamic and all. but, if I want to make a full new language with grammer embedded in LUA. what would be the best approach? would it be making/ using a syntax parser functions interpreted in LUA ?. For example: Lua File: test.lua ------------------ Parser(" Look at [ Joe ] "); Do u guys think it is OK? the parser function will sit in the software, will parse it correctly and activate the right logic for it, and therefore will be interpreted. Plus, I could use plain LUA for other interpretions such as: loading levels, and other. 2) if u read Question number 1: is there anything I'm missing? I plan on using a parser library named GOLD. any recommandations are welcomed. please do. cheers, tomer!
Advertisement
I'm not sure exactly what you're asking. Usually, you embed Lua because you want to do your scripting in the Lua language itself - not use Lua to implement a separate language. In other words, Lua is there to provide a parsing, syntax, and grammar structure for you, not to make it easier for you to provide your own. If all you'd use Lua for is to pass data to another language of your own creation, you may as well just cut out Lua completely.
Lua isn't Lisp - it isn't designed to allow creation of sublanguages. It is however possible to do something like that by transforming small programs in your custom language to strings of lua code and executing those strings.
If you want to do a simple 'language' it can be done with LUA's string library. In fact LUA is quite good at text maniputation

This topic is closed to new replies.

Advertisement