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

bbcode v0.1

Name: Anonymous 2007-09-11 22:38 ID:uR52DJVN

[bbcode]
[title="Hello World"]
[author="Anonymous"]

[main]
  [let="a"]5[/let]
  [while]a>0[do]
  [let="a"]a-1[/let]
  Hello, World!
  [val="a"]
  [/do]
  [/while]
  [call="test"]
[/main]

[test]
hihihi world!
[/test]

[/bbcode]

suggest and improve.

Name: Anonymous 2007-09-13 12:23 ID:2lxbdI5m

I've been working on a BBCode implementation myself.  This is what I have so far (about three hours of work, I'd say):
[foldr]
  [d]asd [_][*]a[/*][*]b[/*][/_]
    [add][_][*]$a[/*][*]$b[/*][/_][/add]
  [/d]
  0
  [_][*]1[/*][*]2[/*][*]3[/*][/_]
[/foldr]
6

I suppose the syntax could need some fixin' ;)  It's all really inconsistent.  foldr and add are primitives (I also have a cudder primitive):
prim_cudder fs ((BBList (_:xs)):_) = BBList xs
prim_add    fs ((BBList ((BBInt a):(BBInt b):_)):_) = BBInt (a + b)
prim_foldr  fs ((BBSymbol fn args body):x:(BBList xs):_) = foldr (\ a b -> (apply fs body (zip args [a, b]))) x xs

fap fap fap

Name: Anonymous 2007-09-13 12:36 ID:Heaven

>>40
I think that mixing executable BBCode seamlessly with normal world4ch posts in a non-asshatterish way is not possible. We need a top-level tag [prog] that separates executable segments from the rest of the post. The body of a [prog] tag would function like >>28 suggested. In the final post, [prog] segments would then be replaced with the results of evaluation.

Name: Anonymous 2007-09-13 12:37 ID:Heaven

>>41
WHAT THE FUCK IS THIS SYNTAX? START OVER, FUCKWARD.

Name: Anonymous 2007-09-13 12:39 ID:Heaven

>>43
Enterprise, bitch, do you use it?

Name: Anonymous 2007-09-13 13:32 ID:Lxi/dWxS

>>42
That wouldn't be much different from what I said, really. In my case, only the top level is treated like regular posts, parsing newlines into <BR/> and so, while anything between [ and ] has Lisp semantics. Since current Shiichan BBCode defines simple tags which take no parameters or anything, they'll be compatible, provided we define b, /b, code, etc. to return proper HTML. In my case, these functions take no parameters and return HTML tags; it's not [b "bold code"] which would cause a lot of problems with recursive tags.

Name: Anonymous 2007-09-13 13:51 ID:Heaven

>>45
But your approach is ugly. [b] et al should be functions that take an arbitrary expression as argument and return the resulting string literal enclosed in an appropriate tag. For example [bee][add]3 [mod]5 2[/mod][/add][/bee]* would return 4.

* [b] replaced with [bee] because I don't remember how to escape BBCode.

Name: Anonymous 2007-09-13 14:17 ID:kiJ6xscN

And now for something related: how am I supposed to read ``properly quoted'' strings with Parsec? Normally this would be trivial, but this ``predictive'' fuckwittery of Parsec doesn't do things the way I want it to do.

My current parser is

bbstring = do string "``"
              s <- many bbchar
              string "''"
              return $ String s


where ``bbchar'' just reads any character and escapes escapes. When it encounters an `''', it fucks up because it fails to recognize that as a closing quote. Any sane parser would simply backtrack, but Parsec is apparently designed to be really fucking fast and to not pay attention to such details. It has the try keyword that should do something like this, but I have no idea how to use it with many.

Name: Anonymous 2007-09-13 17:15 ID:2lxbdI5m

>>43
Okay, I changed the syntax around a little bit!  This new syntax uses spaces in places for nicer lists, but it is more BBCodesque because it doesn't use $variables.

[def] map
    [args]function list[/args]
    [foldr]
        [def] lambda
            [args]a b[/args]
            [colon]
                [apply][var]function[/var] [var]a[/var][/apply]
                [var]b[/var]
            [/colon]
        [/def]
        [ls][/ls]
        [var]list[/var]
    [/foldr]
[/def]
[map]
    [def] lambda
        [args]a[/args]
        [add][var]a[/var] 1[/add]
    [/def]
    [ls]1 2[/ls]
[/map]

Output: [ls]2 3[/ls]

Name: Anonymous 2007-09-13 17:27 ID:Heaven

>>48
Well, at least this version doesn't induce that ``I CAN SEE FOREVER'' effect of your earlier effort, but you're still doing it wrong. >>28 got it right (if we add the [prog] tag). Your version is way too verbose and has completely useless misfeatures like the [var] tags.

Name: Anonymous 2007-09-13 17:27 ID:Heaven

[main]
Hello World!
[/main]

Name: Anonymous 2007-09-13 17:55 ID:2lxbdI5m

>>49
I haven't decided how to handle strings yet, right now strings can't have spaces (or they are considered separate strings), if I decide to have a special syntax for strings I might drop [var], but I like it because it's really BBCodesque.  I added some more primitives and got a recursive Fibonacci algorithm working (I actually didn't know I could call the functions from inside themselves, but now I know):
[def] fib
    [ls]n[/ls]
    [if][equal][var]n[/var] 0[/equal]
        0
        [if][equal][var]n[/var] 1[/equal]
            1
            [add]
                [fib][sub][var]n[/var] 1[/sub][/fib]
                [fib][sub][var]n[/var] 2[/sub][/fib]
            [/add]
        [/if]
    [/if]
[/def]

[fib]8[/fib]

Name: Anonymous 2007-09-13 19:28 ID:Oy/neyE+

>>48
Really, that's ENTERPRISE. Too fucking verbose. Looks like XML. Scheme BBCode is better:
[define [map f l]
        [if [equal? l []]
            []
            [cons [f [car l]] [map f [cdr l]]]]]
[map [lambda [x] [+ x 1]] [list 1 2 3 4]]


>>51
Really, that's ENTERPRISE. Too fucking verbose. Looks like XML. Scheme BBCode is better:
[define [fib x]
        [if [< x 2]
            x
            [+ [fib [- x 1]] [fib [- x 2]]]]]
[fib 8]

Name: Anonymous 2007-09-14 1:36 ID:AGS36hK0

__________
|o|o o|o o|
|o|o|o|o|o|
|o|o|o|o|o|
|o|o|o|o|o|
|o o|o o|o|

lsfsgsdfgh

Name: Anonymous 2007-09-14 3:02 ID:06Cyb+V3

Well if we find some syntax maybe we could use lex and yacc to write the interpreter?
It will be very funny if /prog/ actually manages to create a decent language.

Name: Anonymous 2007-09-14 3:24 ID:xStOluJ5

>>54
fuck lex and yacc, use happy or something

Name: Anonymous 2007-09-14 4:37 ID:5R5FErFA

>>52
Sure, that's shorter -- but it's not BBCode any more!  That's just Scheme with [] instead of ().

And this is supposed to be an Enterprise-grade language -- otherwise it won't be picked up by the mainstream.

Name: Anonymous 2007-09-14 6:40 ID:5omKp7Uo

Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets Let's use R5RS with square brackets

Name: Anonymous 2007-09-14 8:55 ID:X3rOgp6f

screw bbcode. be an EXPERT WEB DEVELOPER and use the currently unfinished HTML 5 and CSS3.

Name: Anonymous 2007-09-14 9:24 ID:5omKp7Uo

HTML 5 unfinished > XHTML x.x finished

Name: Anonymous 2009-03-06 14:31

Very good advice from 28 and 29.

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