|9 points by almkglor 4088 days ago | 77 comments|
|I've made several updates to arc2c this weekend, especially since today we have a holiday in our country, so I had a 3-day weekend.|
My family's a bit pissed at me I think though ^^.
Here's the new stuff:
1) Restructured some bits of the 'compile-file function. Adding new transformations is now easy,.
2) Arc style 'if is now fully supported:
3) ssyntax is now supported: (prn:foo 1), prn!hehe
4) 'load and 'require, if on the top level of the file, now insert the contents of the specified files.
5) variadic functions now work:
6) 'set now works on local variables, see example of 5
(fn (exp . rest)
(let self nil
(fn (exp rest)
(if (no rest)
(is exp (car rest))
(self exp (cdr rest)))))
(self exp rest))))
7) Unused globals which are assigned to, but not read, are removed; also, for 'do blocks, if an expression is not in the tail position and doesn't have potential side effects - basically, literals, quote forms, variable references, and 'fn that aren't called or stored in variables - are removed:
This "optimization" is necessary so that we can simply mindlessly insert library functions (arc.arc contents, as well as some xdef'ed functions in ac.scm) to the source code, and this step will remove the unused library functions, removing code bloat which will probably just make debugging difficult.
1 2 3 4 5)
This step will of course need to be removed/skipped if 'eval is at all used, but most programs won't use eval anyway.
TODO (by my expected priority):
1) Decoupling of primitives from globals, i.e. allow say, 'car and 'cdr to be redefined, instead of automatically making them primitives whenever they are encountered in function position.
2) Macros. Especially 'def. Also 'eval-when. Hmm.
3) Strings. Ooh, look ma, big unicode headaches!!