So I'm planning this little 4x game, and of course every new 4x game worth its salt has user-editable rulesets, so I'm thinking of making t-expressions the basic syntax for rulesets.
So I envisioned something like this (in s-expressions): (unit-type-rules (<ScoutDrone> (unit-class <drone>) (unit-type-name "Scout Drone") (movetype <air>) (moves 3) (military #t) (military-supply 2) (military-attack 2) (military-defense 2) (military-bonus-against (list <vehicle> <siege>)) (worker #f) (settler #f)) (<BasicInfantry> (unit-class <infantry>) (unit-type-name "Basic Infantry") (movetype <air>) (moves 1) (military #t) (military-supply 2) (military-attack 2) (military-defense 2) (military-bonus-against (list <drone> <siege>)) (worker #f) (settler #f)) unit-declarations ...) Now, the t-expressions form certainly looks quite cute: unit-type-rules <ScoutDrone> unit-class <drone> unit-type-name "Scout Drone" movetype <air> moves 3 military #t military-supply 2 military-attack 2 military-defense 2 military-bonus-against $ list <vehicle> <siege> worker #f settler #f <BasicInfantry> unit-class <infantry> unit-type-name "Basic Infantry" movetype <air> moves 1 military #t military-supply 2 military-attack 2 military-defense 2 military-bonus-against $ list <drone> <siege> worker #f settler #f unit-declarations ... Except for two issues: I can't put empty lines between declarations, and I better make sure that my unit types <ScoutDrone> etc. start on the same indent level, even if they are several dozen lines apart. A similar issue comes up with the R6RS library form: (library (foo bar) (export foo bar) (define (foo x) several-long-code-pieces ...) (define (bar y) several-long-code-pieces ...) ); end library --- So let me propose the indent everything symbol WHERE: "<-" library (foo bar) <- export foo bar define foo(x) several-long-code-pieces ... define bar(y) several-long-code-pieces ... -------- unit-type-rules <- <ScoutDrone> unit-class <drone> unit-type-name "Scout Drone" movetype <air> moves 3 military #t military-supply 2 military-attack 2 military-defense 2 military-bonus-against $ list <vehicle> <siege> worker #f settler #f <BasicInfantry> unit-class <infantry> unit-type-name "Basic Infantry" movetype <air> moves 1 military #t military-supply 2 military-attack 2 military-defense 2 military-bonus-against $ list <drone> <siege> worker #f settler #f unit-declarations ... ---- What do you think? Another alternative: library (foo bar) \{ export foo bar define foo(x) several-long-code-pieces ... define bar(y) several-long-code-pieces ... \} Sincerely, AmkG ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss