Bison: Implementing the code after rules
Hey Guys, i'd like to ask someone who implemented a language in bison.
How long does it take to implement the code side after you finish all of the rules? I dont know if i sho开发者_开发百科uld do it or not. Currently i am at 600 LoC (counting the middle part of the %%)
How long would it take to implement the code? I know it will vary but how long did it take for you to implement?
Will it take days? months? or many months/years? If its two weeks or less i may go ahead and do it. If its more then 2 months i wont consider it (at least not at this point).
Just asking for an estimate. I need to also consider the backened code. Converting the language to C++ or C# should be trivial though. Anyways i want an estimation to get a rough idea.
I could give you a lot better answer if I had some idea what your code looked like. Given that it's 600 lines (just for the bison, not the flex?), I doubt you can get it working in two weeks. You might be able to get something typed in by then, but I doubt you'd get it to "fully working" within a month. Mostly this is due to "it's going to take longer because it's your first time" and "the first big thing you write in a language is probably going to need a full refactor, because you didn't architect it to work well with the language."
If you put parts of your code up (starting with the lexer) for us to look at, asking if it is a good implementation of the given technique (AST, comment parsing, string quoting or escaping, whatever), you might be able to knock that down to a more manageable size before you start hanging code on tokens.
You are being far too coy with what you are trying implement.
But I'll make a categorical statement: If you are trying to implement a language with the proxy measures that you cite and are not an experienced language designer (e.g. at least one successful, novel, working, usable, and used implementation) you are in over your head.
You lack either the experience to turn your simple language idea into a proper form or, you've got a target language that is so complicated that it will be unusable. That is, if it is that hard to make a compiler understand it, a human will never be able to comprehend it.
My recommendation: stop, take a step back, rethink what you are trying to achieve, explore other implementations, see if you really have something inexpressible in other languages. And if you've done all that homework and find that you still want to build your language at least you'll have perspective you didn't before.
Language design is very, very difficult to do well.
精彩评论