Closed exKAZUu closed 10 years ago
I believe we can fix problems except for the last one using just replacement.
Try to load this project in Garry's mod. You will find that it will give no syntax errors.
That's because there's a difference between Lua and GLua. Garry Added support for the exact things you mentioned. You should not try your Lua parser on a GLua project if pure Lua is what you want to parse.
You could also add support for these syntax additions. Most of them are silly, they were added because Garry couldn't get used to Lua 's syntax. Other things, like the continue keyword, are indeed very useful.
I see. Sorry for my ignorance.
You can read more about the differences here: http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexba22.html
Even though the site is out of date, the info on that particular page is still correct. You might want to be able to parse GLua scripts. That should be possible without hurting interpretation of standard Lua scripts. What are you making the parser in anyway, Haskell?
Thanks! I'm using ANTLR v4 and then I also wrote GarryLua version. https://github.com/exKAZUu/Code2Xml/blob/master/Code2Xml.Languages/ANTLRv4/Processors/GarryLua/GarryLua.g4
I tried to parse this project using my GarryLua parser and I confirmed there was no syntax error :)
That is really cool! As it happens I'm following a course on Languages and Compilers at Utrecht University. We have to parse things using Haskell (Alex and Happy libraries). I was wondering how parsing was done in imperative languages. Nice project!
Thank you :) I hear these libraries first and they also seem to be interesting!
I'm now developing Lua 5.2 parser and testing my parser using your project. I've noticed this project may contain many syntax errors. I can't fix all them so instead I list what problems there are. I'm not an expert in Lua so please check the official document (http://www.lua.org/manual/5.2/).
--
should be used instead of//
--[[
and]]
should be used instead of/*
and*/
~=
should be used instead of!=
and
andor
should be used instead of&&
and||
continue
is not supported so should modifyif cond then continue end stmts
toif not cond then stmts end