2

I am parsing a file using c#.

This file contains some strings, which are short Lua scripts defined by other users. It is possible to check syntax of this Lua scripts without creating ATS and writing my own front-end of compiler?

Mostly it is only one line of script, for example:

 Dialog[4].SimStatus ~= "WasDisplayed" and Variable["points"] > 15

Thanks in advance

Mad
  • 253
  • 2
  • 18

1 Answers1

0

Short answer: Yes.

Longer answer: you only need a syntax checker, not a compiler, so check if brackets open and close count is the same etc.

SynerCoder
  • 12,493
  • 4
  • 47
  • 78
  • But it is not enough. I have to check all characters in the string, check whitespaces, check validity of function calling (there are some. User can create his own function or call any defined in Lua. If he calls something that not exists I need to catch this as error) – Mad May 07 '14 at 10:11
  • That is not a syntax checker, you need a semantic checker, try reading upon that. – SynerCoder May 07 '14 at 11:38
  • When you have read up on semantic checkers, and then have questions, don't hesitate to come back to SO, if a provided answer answers your questions please mark it as answered. From the [help section](http://stackoverflow.com/help/accepted-answer): "Accepting an answer is not meant to be a definitive and final statement indicating that the question has now been answered perfectly. It simply means that the author received an answer that worked for him or her personally" – SynerCoder May 08 '14 at 12:13