Hi list, After looked into the discuss 2 months ago between Nicolaos and Eric, I'm interesting to try to make a M4 implement in Rust to better understand m4 and for fun. A naive version is easy to made (I have both study the BSD implement and GNU implement together to make a better architecture). But it seems that both two implement can not well handle recursive `$@' in O(1) . So I start to study the implement of 1.6 version of GNU m4 and make a new implementation based on the idea of that version.
But in the meantime of implementing, I have found a wired behavior of `defn'. The document said: > If name is a user-defined macro, the quoted definition is simply the quoted > expansion text. If, instead, there is only one name and it is a builtin, the > expansion is a special token, which points to the builtin’s internal > definition. This token is only meaningful as the second argument to define > (and pushdef), and is silently converted to an empty string in most other > contexts. Combining a builtin with anything else is not supported; a warning > is issued and the builtin is omitted from the final expansion. But this text: define(`foo', defn(`defn') bar) it should be same as: define(`foo', bar) as the defn(`defn') expands to empty, and the whitespaces after `,' will ignored. But I found it defined a wired macro: foo => foo foo() => I noticed the statement: "This token is only meaningful as the second argument to define (and pushdef)", So I tried without `define': define(`foo', `[$1]-[$2]') => foo( first , defn(`defn') second) =>[first ]-[] I think it should be expand as: => [first ]-[second] or even: => [first ]-[ second] So which behavior is correct? -- regards, Xavier Wang.