bakergo•

I'm throwing a penalty flag here.

  • Multiple statements in 1 line of code

while (sym == PLUS || sym == MINUS)

{ t=x; x=new_node(sym==PLUS?ADD:SUB); next_sym(); x->o1=t; x->o2=term(); }

  • Completely unhelpful comments

node *paren_expr(); /* forward declaration */

  • Entirely bizarre indentation

These are especially egregious since LOC was expanded by uselessly prolific statements.

int ch = ' ';

int sym;

int int_val;

Expands to 380 lines of C (given by cloc) after run through indent -kr and cuddling open braces.

2
jaen_s•

Marc Feeley is the author of the high-performance Gambit Scheme compiler. The indentation style is likely a crossover from Lisp to C. You can also see die-hard Python programmers writing C code in a similar manner.

4
fullouterjoin•

Marc Feeley along with Fabrice Bellard are on high on the log(bad_ass) scale.

2
SliceMusik•

I must he has a dedication for Scheme and Gambit in particular. I've had a class with him and it's like he lives on Scheme. Good teacher also, hard class but you learn a lot (Programming Language Concepts, part of second year of Computer Science Bachelor, second part is functional programming using Scheme).

1
aaronla•

Especially a shame as 380 lines is still impressive

3
bakergo•

380 lines of code is pretty impressive considering the task & feature set. It clearly wasn't written with "minimize SLOC" as the main priority, since it could have easily been made smaller simply by dropping the functions into a switch or something dumb like that.

That said, I consider 291 an unfairly calculated line count, and I'll stand by 380.

0
tittyblaster•

it's a shame that this subreddit seems to be promoting bad coding behavior...

2
paul2520•

The code compiles fine, but whenever I execute it, it gives me a "syntax error" at best. I have tried each of the examples given in the comment section, and they all result in the same error. Any ideas?

1
zenspider•

works fine for me when compiled with clang (compiles w/o warnings). llvm-gcc is clean as well. I don't have any other C compilers available right now.

2
eddavis2•

What OS are you running this on?

Try this: echo a=1; | a.out

If you are on Windows, it is probably the quotes that are giving you problems.

2