That's a lot of code

Mar 29, 2006 12:20

So Prabhakar estimates that a reasonable compiler written in Scheme will have about 15000 lines of code. pcolijn_feed's and my current count: slightly under 7000. Perhaps that's why we're not generating very much code yet.

Actually it makes me feel a little relieved because I was wondering if our code count was high given the expressiveness of Scheme.

compilers, scheme

Leave a comment

Comments 19

anonymous March 29 2006, 19:02:33 UTC
I said you shouldn't need more than 15000 lines of code. I bet you can do it with less, but maybe not in R5RS Scheme, and it really depends on what you're trying to accomplish. Are you using macros at all?

If you send me a chunk of code, or put it on a page somewhere where I can get at it, I can give you an uninformed opinion on its expressivity.

Reply


80-columns caffeinemonkey March 29 2006, 22:19:25 UTC
The other thing is that due to my obsessive-compulsive insistence of keeping things down to 80 columns, some of our lines have very little on them.. so I don't think our code is all *that* expressive.

We don't use macros really, but we do do a bunch of currying and such.

Overall I'm pretty happy with our choice of scheme; the one super annoying thing is the lack of decent debugging support, as in "you did (car '()) 'somehwere'". Oh, great. Thanks. Somewhere in my 7000 lines of code I car an empty list; such useful debugging information.

Reply

Re: 80-columns caffeinemonkey March 29 2006, 23:20:12 UTC
That's 'cause you're using SCSH. I would have told you to use PLT Scheme, which has a proper IDE, and gives you a complete stack trace when there's an error. (There's even a scriptable debugger in the latest release, though I haven't attempted to try using it ( ... )

Reply

Re: 80-columns morethanreal March 29 2006, 23:51:17 UTC
You can get a backtrace with scsh. If the script is run interactively, it will stop on exception and you can use ,debug to get a backtrace. No line numbers, but I've found it pretty useful. caffeinemonkey, the start-scsh script will start scsh with all the libraries we need.

We can use the SRFIs and all the extensions. I'm not sure if we're coding idiomatically since I'm not sure what the Scheme idioms are, and whether we have good abstractions depends on whether the code is written at 2pm or 4am :)

Reply

Re: 80-columns caffeinemonkey March 29 2006, 23:59:35 UTC
Two weeks of Scheme in 241 doesn't really teach you about idiomatic coding, does it? So send me your code already...

Reply


Leave a comment

Up