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

Pages: 1-4041-

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-11 23:03 ID:Heaven

That looks like BASIC.
I'm willing to write a BBCode parser as long as someone comes up with good syntax.

Name: Anonymous 2007-09-11 23:05 ID:bSo/zKt7

Maybe use an ENTERPRISE TEXT FORMATING ALGORITHM to show off your true understanding of BBCode.

Name: Anonymous 2007-09-11 23:43 ID:0KewA/Uc

How about this
To define a tag you write [:hello].
Example

[:expert][b][u][o][][/o][/u][/b][/:]

[expert]I AM AN EXPERT PROGRAMMER[/expert]

You can explicity specify how many arguments a bbcode tag can have

[0:2br][br][br][/:]

So [2br] => [br][br]
[2br]wtf[/2br] produces an error by the parser/compiler.

For this to work, we need a good standard tag library.

Name: Anonymous 2007-09-11 23:44 ID:Heaven

>>4
Oh yeah, and [] is the array of arguments, while [n] is that certain argument.

To call a function you simply [function_name] not that [call="function_name"] crap

Name: Anonymous 2007-09-11 23:46 ID:b3hp8tZN

[bbcode]

[int=a][/int]
[for=a, 1 to 100]
 [print]a[/print]
 [if=0]mod a 3[append]"fizz"[/append][/if]
 [if=0]mod a 5[append]"buzz"[/append][/if]
 [+=a]1[/+]
[/for step=1]

[/bbcode]

Name: Anonymous 2007-09-11 23:53 ID:Heaven

Thank god you people don't design languages

Name: Anonymous 2007-09-12 0:05 ID:7f78HXrR

should look more like, b isnt used, but just to demonstrate

[include="path_if_not_in_same_directory_as_compiler"]
stdio.h, stdlib.h
[/include]

[main]

[var=int]a, b[/var]

[for=1:100; a, b]
  [print=a, b][/print]
  [if=0; a]mod a 3 this is comment[print="fizz"][/print][/if]
  [if=0; a]mod a 5 this is comment[print="buzz"][/print][/if]
  [op=add; a 1][/op]
[/for]

[/main]

Name: Anonymous 2007-09-12 0:07 ID:Heaven

>>8
Do you seriosuly want to write 'add' each time you want addition?
How about
[op=+; a 1]
Or even [+ a 1]

Name: Anonymous 2007-09-12 0:14 ID:7f78HXrR

>>9

just make it [+:a, 1] with no [/+] because that looks retarded

Name: Anonymous 2007-09-12 0:17 ID:Heaven

>>10
Orly? Wtf is +: supposed to mean?
Fuck, we need to write a BBCode standard, and then the compiler/interpreter.

Name: Anonymous 2007-09-12 0:34 ID:Heaven

Proposed syntax:

[cοde]
for i in range(1, 10):
    print 'OMG BBCode!!!'
[/cοde]

Name: Anonymous 2007-09-12 1:21 ID:/VaIOmVO

screw you people, i've already started defining a syntax, and it is superior to yours.
e.g:

[BBCPL]
[DEF = "EXPERT"][b][o][u]^[/u][/o][/b][/DEF]
[DEF = "LINK"]<a href ="$1">^</a>
[FOR = " [INT = "i"]o[/INT]:[i]<5:[+[i],1]]
[LOL]
[/FOR]
[/BBCPL]

[FUNC = "LOL"]
     [PRINT]Hello world!
     [EXPERT]EXPERT BBCODE PROGRAMMING![/EXPERT]
     [LINK ="http://mitpress.mit.edu/sicp/"]READ SICP![/LINK][/PRINT]

[/FUNC]

as you can see, this is EXPERT BBCODE

Name: Anonymous 2007-09-12 1:38 ID:6+h3m/fp

>>13
I wouldn't trust the defining of BBCode syntax to someone who can't write well-formed BBCode.

Name: Anonymous 2007-09-12 3:10 ID:abeb40cm

Enjoy your fucking endless rendering loops

Name: Anonymous 2007-09-12 4:58 ID:F0/CRoZ7

I propose Scheme with square brackets, adding a few functions to the standard library, namely:

[define [b] "<B>"]
[define [/b] "</B>"]


etc.

Name: Anonymous 2007-09-12 6:30 ID:HrBUX3P5

I laughed reading this thread.
Also, >>7 is an awesome post.

Name: Anonymous 2007-09-12 17:01 ID:wcnwp2gq

srsy, how going to make the compiler?

Name: Anonymous 2007-09-12 17:03 ID:6+h3m/fp

There needs to be a decent language specification first.

Name: Anonymous 2007-09-12 17:06 ID:9cI5QvB3

[define add[+ a b]]
[add 3 4]

Output : 7

Perfect lisp-like syntax

Name: Anonymous 2007-09-12 17:11 ID:Heaven

>>20
ewwwww. lisp.

Name: Anonymous 2007-09-12 17:17 ID:6+h3m/fp

>>20
That's much better than those steaming piles of crap suggested by the imperative fuckwits, but still that's only lisp with parentheses replaced with square braces. That doesn't make it any more interesting.

Name: Anonymous 2007-09-12 17:23 ID:Heaven

>>22
Not at all. Note, for example, how he cleverly disposed of explicit argument declaration, and instead went for simple automatic argument assignment to a b c ...

Name: Anonymous 2007-09-12 17:36 ID:kf7dJaPf


[definition]
[name]factorial[/name]
[style]function[/style]
[computation]0,0[/computation]
[computation]x,x*[factorial]x-1[/factorial][/computation]
[/definition]

[factorial]4[/factorial]


24

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

>>24
Too [b]ENTERPRISE[/b].

Name: Anonymous 2007-09-12 17:46 ID:wcnwp2gq

fail

Name: Anonymous 2007-09-12 18:06 ID:aHDKJcQL


[?bbcode
function expertProgrammer[ $$$ ][
    unshift[__$__]
    goto[return] swap : [unshift . $]
]
getFunctionByTagName[`expertProgrammer'][0].__call__
?]

Name: Anonymous 2007-09-12 18:26 ID:/u8bhl3H

>>20
Pretty good, but we should take advantage of the ability to name or not name blocks as we wish.

[define]
  add-pair
  [+]a b[/+]
[/define]

# [add-pair]1 5[/add-pair]
6
# [add-pair]1 5 [atom name=lol]``code''[/atom][/add-pair]
6
Numbers and strings written alone are shorthand for [atom]value[/atom]. If they are given as parameters to a function, they get the names a, b, c, etc. The symbol "args" is a list of all unnamed arguments. When a function foo (e.g. [foo]) is followed by one or more parameters of the form n=x (e.g. [foo n=x]), those symbols are bound to those values in the environment that function is evaluated in. They go out of scope when it ends. However, a function may also return a named value which enters the environment "the next level up". So, in the last example, [add-pair] is evaluated, then its arguments 1 and 5 are evaluated and assigned the symbols a and b, respectively. Then the next argument is evaluated. Atom's environment contains the binding 'name = "lol"', and creates the binding 'lol = 7' in its caller's environment. If we were to add the code [when][boundp]lol[/][return]``idk, 60 million lol''[/return][/when] to add-pair, then the second example would return the string ``idk, 60 milion lol'' in the second example, rather then the correct answer of 6. Also note that [/] may be used to close a block if your typing finger is tired, and that quotes are written ``'' for enterprise-grade nestability.

Name: Anonymous 2007-09-13 5:46 ID:kiJ6xscN

>>28
I like your idea, except for this:

Also note that [/] may be used to close a block if your typing finger is tired

Name: Anonymous 2007-09-13 6:41 ID:M0lhehee

>>28,29

How about [<tab>?

Name: Anonymous 2007-09-13 6:41 ID:M0lhehee

>>30
Actually, that'd be an editor feature and it doesn't have anything to do with the actual language

Name: Anonymous 2007-09-13 6:49 ID:1nFBKgZX

>>31 despite your moot comment I acknowledge your awesome ID.

Name: Anonymous 2007-09-13 7:05 ID:M0lhehee

Holy fuck

Name: Anonymous 2007-09-13 7:07 ID:Heaven

>>33
Not quite as awesome as sunp0mer, but awesome nonetheless.

Name: Anonymous 2007-09-13 7:11 ID:Lxi/dWxS

I already have a BBCode specification, it's called R5RS + >>16

>>31,33 has one of the best IDs I've seen

Name: Anonymous 2007-09-13 7:23 ID:Heaven

Actually, the ``Scheme with square brackets'' is not that great. It doesn't follow the traditional BBCode syntax very well. >>28 has the right idea.

Name: M0lhehee!CRAWuOba 2007-09-13 9:00 ID:M0lhehee

Name: Anonymous 2007-09-13 9:11 ID:Lxi/dWxS

>>36
Why? It's backwards compatible with existing BBCode, as long as you make b, /b, etc. functions that return HTML.

Name: Anonymous 2007-09-13 9:28 ID:Heaven

>>38
It doesn't follow the semantics. In scheme, you do (foo a b c) where in BBCode you need to write [foo]a b c[/foo] to keep it consistent with how the pre-existing tags work.

Name: Anonymous 2007-09-13 11:50 ID:Lxi/dWxS

>>39
I propose that anything at top level that is not a function call should be treated as literal (and HTML-escaped). This way:
[b]a b c[/b]
would be treated as (display "<B>") (display (html-escape "a b c")) (display "</B>") yet
[foo a b c]
would be treated as (foo a b c).

The problem with [foo]a b c[/foo] is how to treat what's outside the square brackets. Is it three symbols? A string? Is whitespace significant? Etc. We'd have to treat everything outside [] as a whitespace-sensitive string, and all functions would have to be functions of one string argument returning one string. And this means we can't return functions. And this means we can't fix the one arg limit as you would in Lambda Calculus. Unless you allow nesting [], which would be piss ugly... (add 1 2) would become:
[[add]1[/add]]2[/[add]1[/add]]

All of this means we'd be getting something worse than Tcl. So I propose a Lisp, with the toplevel exception I described.

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.

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