tags:

views:

47

answers:

2

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 should 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.

+1  A: 

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.

Mike DeSimone
+1 The lexer is a beast as well. 240 lines ATM do you have a comment about that lexer size?
acidzombie24
Again, can't say without any idea of what you're trying to *do*. A lexer for SQL can get that big from all the keywords.
Mike DeSimone
The language is my own similar to C++. It has templates, operator overloading everything C++ has but different syntax (theres 0 conflicts. different syntax is required to do that) and some new features.
acidzombie24
Then I'd bet on two months, plus however long it takes you to learn ASTs and maybe RTL. You might be able to get something basic running in a couple weeks, that works with a few input files, but most of your coding will need to deal with input errors and how to handle them gracefully. That takes a long time, since there's always some case you forgot that a user will find. Even if all you're doing is translating to C++ or C# (beware the Inner Platform Effect and Wheel Reinvention), you still have to catch everything and ensure that your output is error-free.
Mike DeSimone
A: 

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.

msw
This is good and all but the rules are all done and i just wonder if i should take the plunge and implement the code or leave it only checking syntax. I did attempt a light version just to understand how to implement things properly. I had a lot of core dumps at the beginning. I understand it now. But anyways, so i wonder if this can be done full time in a month (rather then 2 weeks) or not.
acidzombie24
If you don't tell us the language, or hint at the language, we've got nothing.
msw
its my own similar to C++. It has templates, operator overloading everything C++ has but different syntax (theres 0 conflicts. different syntax is required to do that) and some new features.
acidzombie24