Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The BBCode programming language

Name: Anonymous 2007-07-18 6:39 ID:PTojbCHk

This is for real. I'm considering writing a BBCode programming language, intended for use in message boards. It'd be backwards-compatible with the current BBCode, but it'd allow you to write ad-hoc programs that generate your post.

Basically, it'd be a LISP, with these four properties beyond the usual:
- Only you configure the opening and closing parens, which you can set to [].
- In the top level, any sequence of characters that is outside of any application (outside []) is evaluated as string (preserving whitespace and everything), and returned as is, except <, > and & are converted to HTML entities.
- The resulting post is the concatenation of everything that's evaluated at top level, which means you get everything in the top level outside [] and every string any functions you called returned. (Other types functions may return are converted to their canonical representation.) Function results may safely return HTML; their <, > and & are not automatically converted to HTML entities.
- When you apply a non-applicable or non-existent symbol, you get a string which consists of [, the symbol, and ], so that unrecognized tags are printed as is (which is the current behaviour in BBCode).

For example, this would define the [ b ] and [ /b ] for bold, assuming we're using { and } for open/close parens (used {} so that BBCode doesn't fuck it up)

{define {b} "<b>"}
{define {/b} "</b>"}


What do you think?

Name: Anonymous 2007-07-18 9:34 ID:PTojbCHk

Ok, so >>4 asked for an example and here's one that will make a post like:

>>1
NO U

>>2
NO U

...

for all previous posts, assuming we can get the current post number with (meta 'current-post).


Hello everybody,

\[define no-u \[lambda \[x] \[limit]
    "NO U at posters x, x + 1, ... limit - 1"
    \[print >>x EOL \[b] "NO U" \[/b] EOL EOL]
    ;Note: >>x would be a macro that works at top level too
    \[if \[< x limit]
        \[no-u \[+ x 1] limit]]]]
\[no-u 1 \[meta 'current-post]]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List