Introduce a new language, check syntax?

I was thinking about a new programming language. Before trying to implement it, I would like to check the syntax of the code to see if there is a lot of ambiguity. (I find it funny that its possible to make var ++++ for a class)

+1


source to share


2 answers


Write the syntax in the correct format and use Antlr or any other parser generator to generate the parser. Usually you are warned about ambiguity.



+8


source


Remember, grammars that are ambiguous for one parser style are not ambiguous for another.



If you want the language to work for you, check with the parser generator you plan to use. If you want to make it easier for others, test a few parser generators and study their errors / warnings until you understand the ambiguity they see.

+1


source







All Articles