Quote (AbDuCt @ Nov 6 2014 02:26am)
Personal question from an untrained hobbyist.
What rules do you set in order to maintain like typing for variables, classes, and function names?
As in do you camel case for everything (someVar, someFunction()) or do use some other method? I notice some of your functions have underscores in them while others do not. Also do you ever prefix variables with their type (iMyVar, sSomeString, cCharacters).
I find it difficult to maintain one naming convention. It seems like every other project I am changing it.
Basically which do you like/use and why.
I personally haven't thought too much about it. I have heard some people do as you say (using prefixes).
I have always just used names that generally strongly refer to what a variable is / what a function does
In the case of my parser, the function names were literally the productions of a BNF grammar from our teacher (stuff like <program>, <T>, <F> etc)
I appended the _NT (NON-TERMINAL) just as a way to make them unique.
I currently like the way I do it, but it is also true I have never tried prefixing variables.
For functions, I am a big fan of the camel case. I make exceptions for parser because tNT or TNt etc make ugly functions
Quote (Minkomonster @ Nov 6 2014 02:26am)
When I took this course in uni I had a fucking blast. Our compiler was a group project. I wanted to write it in C, but no one else on my team knew C and they wanted to contribute to the coding. So we did it in Java, because that's the only language they knew -.-
And I ended up writing it by myself anyways...meh.
Yeah, ours is a cumulative solo project. As a result, the language is pretty simple (I posted a shitty example program above).
Our language does not have case sensitivity, no functions, etc.
Also, it is a top-down parser, so it is already a bit constrained. Bottom-up is much better I hear.
This post was edited by Eep on Nov 6 2014 01:34am