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

/prog/BOL 2012

Name: Anonymous 2012-01-22 12:03

identity is of type for all types A, A to A.
define function identity of x:
   return x.
end.

constant is of type for all types A and B, A to B to A.
define function constant of x of y:
   return x.
end.

define factorial of type int to int of n:
   if n equals 0, then: return 1.
   else: return n times factorial of (n minus 1).
end.

Name: Anonymous 2012-01-25 10:49

>>35-39 please stop.

quick, someone write a grammar for it!

Name: Anonymous 2012-01-26 0:48

return to front page.

Name: Anonymous 2012-01-26 1:38

>>41
We should first decide what the standard features will be. We should for a /prog/mittee.

Bump over the jews.

Name: Anonymous 2012-01-26 1:39

>>43

is the OP present? I would feel bad about hijacking his creation.

Name: Anonymous 2012-01-26 1:43

>>44
err, ey's creation

Name: Anonymous 2012-01-26 1:56

Will this /prog/BOL work on the previous PROGBOL's virtual machine?

Name: Anonymous 2012-01-26 3:35

>>46

sure, why not.

here's a start....


    identity is of type for all types A, A to A.
    define function identity of x:
       return x.
    end.

    constant is of type for all types A and B, A to B to A.
    define function constant of x of y:
       return x.
    end.

    define factorial of type int to int of n:
       if n equals 0, then: return 1.
       else: return n times factorial of (n minus 1).
    end.
type_declaration : identifier 'is' 'of' 'type' type_expression '.'
                 ;

type_expression : optional_type_quanitification type_sequence
                ;

optional_type_quanitification : type_quantification ','
                              |
                              ;

type_quantification : 'for' 'all' 'types' type_list
                    ;

type_sequence : type_expression
              | type_sequence 'to' type_name
              ;

type_list_ : type_expression
           | type_list_ ',' type_expression
           ;

type_list : type_expression
          | type_list_ ',' 'and' type_expression
          ;

argument_list_declaration_ : identifier
                           | argument_list_declaration ',' identifier
                           ;

argument_list_declaration :  identifier                              COMMENT: are functions allowed to not take any arguments?
                          | argument_list_declaration_ ',' 'and' identifier
                          ;

type_name : identifier
          ;

optional_function_type : 'of' 'type' type_expression
                       |
                       ;

function_definition : 'define' identifier optional_function_type 'of' argument_list_declaration ':' function_body 'end' '.'

function_body : ....

expression : ...

Name: Anonymous 2012-01-26 17:00

>>47
Perfect!

Name: Anonymous 2012-01-26 20:58

sgsgdfsgdf

Name: Anonymous 2012-01-26 23:23


function_body : statement_list
              ;

statement_list : statement.
               | statement_list statement.
               ;

statement : expression
          | return expression
          | 'if' expression ',' 'then' ':' statement_list 'else:' statement_list 'endif'
          ;

----------
FOIC can be used to avoid the endif above, but I don't know how to express FOIC in gramas.
---------


expression_list_ : expression
                 | expression_ ',' expression
                 ;

expression_list : expression
                | expression_list_ 'and' expression

function_call : identifier 'of' expression_list

term : identifier
     | constant
     | function_call
     ;

expression : term
           | term binary_operation term
           | expression binary_operation term
           ;

Name: Anonymous 2012-01-26 23:46

>>50
U MENA ``FIOC''

Name: Anonymous 2012-01-27 0:14

>>51

Forced orientation inversion catastrophe

Name: Anonymous 2013-04-11 16:11

mootles.progbol:
Add mods to /prog/ giving shit.

Name: Anonymous 2013-04-14 17:07

Name: Anonymous 2013-04-14 17:08


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