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

Pages: 1-4041-

What Scheme does /prog/ use?

Name: Anonymous 2012-01-28 22:31

I have been using Chicken for a little bit. Used Racket for like 5 minutes. R6RS is PIG DISGUSTING!

That is all.

Name: Anonymous 2012-01-28 22:32

chicken when I'm doing call/cc stuff. scm otherwise.

Name: Anonymous 2012-01-28 22:34

javascript

Name: Anonymous 2012-01-28 22:41

javascheme

Name: Anonymous 2012-01-28 23:17

schemescript

Name: Anonymous 2012-01-29 0:08

I wrote my own. It supports all the features I need.

Name: Anonymous 2012-01-29 2:07

>>6
I want to be a cool hacker like you.

Name: Anonymous 2012-01-29 7:43

>>7
Well then write your own. It's not hard and it's a lot of fun. In fact, programming a Scheme interpreter in C is a lot like programming in Scheme once all the basic abstractions are laid out. Start with a basic generic object type.

typedef struct object {
    int type;
    union {
        struct {
            object *car;
            object *cdr;
        } pair;
        char *symbol;
        char *string;
        double number; /* or implement bignums if you want */
        ...
    } val;
} object;


Now write cons, car, cdr, symbol, string, number, etc. and you're ready to the write the parser.

Since code is data in Scheme, you can write a parser that simply translates text to data and not worry about executing it. Write it just like you would a recursive function in Scheme. The parse takes a "list" (either an array of chars or a FILE stream) and returns a tree (of objects) that represent the code as data.

You should also write display concurrently so you can have display(parse(stdin)); in your main loop until the parser is completed. Once the output is equivalent to the input, you're ready to move on.

Next step is eval. Once you have your generic Scheme object and all the necessary primitive-like constructors, predicates, accessors and mutators, you could translate the metacircular evaluator from SICP to C in a few hours. The MCE is not that elegant, however, and will certainly be slow as balls. The way it stores the environment for instance is too complex and can be greatly simplified. Primitive and compound procedures are better represented as native C structs contained in object rather than "tagged lists". MCE's eval however is a good starting point for learning how to implement the define, lambda, and if special forms.

Next, write apply. Binding primitives to your application will be time consuming and tedious, but it's rewarding once your able to start running real Scheme programs. Read R5RS for implementation details.

At this point, you can either write special forms for and, or, cond, let, begin, etc. or you can just implement define-syntax and do the rest in Scheme. It all depends on whether you want a pure C implementation or just a tiny C core. Both have pros and cons (no pun, etc. etc.).

Good luck.

Name: Anonymous 2012-01-29 10:14

>>8
An actual informative post on /prog/? I commend you.

Name: Anonymous 2012-01-29 11:20

chicken lyf

Name: Anonymous 2012-01-29 13:09

>>8
I'd argue that a bytecode (stack machine) compiler would be easier to write.  Your move.

Name: Anonymous 2012-01-29 13:15

>>11
A bytecode(stack machine) isn't the same thing as a compiler.

Name: Anonymous 2012-01-29 13:17

NO U. GAME OVER U STUPID KID!!!

Name: FAGGOT 2012-01-29 13:19

I am FAGGOT. Fuck me.

Name: Anonymous 2012-01-29 13:25

keep fucking that chicken

Name: Anonymous 2012-01-29 13:29

>>15
Don't be j.

Name: Anonymous 2012-01-29 14:16

>>8,11

Here is my, pathological, scheme object scheme for 32-bit systems. This is pretty standard for most C-based implementations of scheme, and possibly, most LISPs for that matter. Notice the use of the struct hack and the size field in the manifest. This makes the compacting GC's job simpler in reckoning with objects on the heap, while placing on the allocator the burden of calculating and recording the size of each object.

typedef struct obj
{
    //manifest
    struct {
        unsigned int type   : 5;
        unsigned int gc     : 1;
        unsigned int vec    : 1;
        unsigned int pad    : 9;
        unsigned int size   : 16;
    };
    union
    {
        struct obj     *l;
        signed int      i;
        float           f;
        char            c;
    } datum[0];
} obj;

Name: Anonymous 2012-01-29 14:21

>>17
sexp

Name: Anonymous 2012-01-29 14:42

>>17
if you swap the l and the f you get: THE FORCED INDENTATION OF LISP CODE

:3

Name: Anonymous 2012-01-29 16:06

>>17
datum[0]
If you're making it variable sized, why use a hack like that? Instead use arrays directly and follow the convention that the first element in every array is the manifest.


union obj
{
    struct {
        unsigned int type   : 5;
        unsigned int gc     : 1;
        unsigned int vec    : 1;
        unsigned int pad    : 9;
        unsigned int size   : 16;
    }           manifest;
    union obj  *l;
    signed int  i;
    float       f;
    char        c;
};

Name: Anonymous 2012-01-29 16:31

>>20

Because, I found it easier to read and reason about, as I was writing it. However, I wouldn't imagine there's really any difference, at all.

Name: Anonymous 2012-01-29 16:45

I will never be smart enough to make my own compiler for any language even if it's a toy one i make up

                                                                                                                                                     
                                                                                                                                                     
                       ```.:/osyyysoo++/:``          ``.--:---.`````                                                                                 
                   ` ``-+sysssssssssssssyso+-`   .:/+ossysyysssso/-`                                                                                 
                   `./osssssssssssssssssssssyo//syyssssssssssssssss+-```                                                                             
                  `/ssssssssssssssssssssssssssyhyssssssssssssssssssss/`                                                                              
               ``-ssssssssssssssyyyyyyyyyyssssssyssssssssssssssssssssy/`                                                                             
               `/osssssssssyyyysssssssssssyyyyysyhsssssssssssssssssssss-`                                                                            
              ./sssssssssyysssssssssssssssssssshhdhyyyssssssyssssyyyyyhs/-.`                                                                         
            `.+ssssssssssssssssssssssssssssssssssyyyssssssssssssssssssssssso/.`                                                                      
            `/sssssssssssssssssssssyyyyyyyyssssyyyyhyysssssssssysyyyyyyyysyysss-                                                                     
        ``.:+sssssssssssssssssssyyyyyyyysyysssssssssssyhsssyyyyyyyyyyyyyyyysysyo/-`                                                                  
       `:+sydssssssssssssssyyyyyyyyyyssssssssssssssssssyhhyysssssssssssssssssssyyy-`                                                                 
    ``-syssyysssssssssssssyyyyyyyssssssssssssyyso+o+++/osyysssssooooohmdmmho+/++osso```                                                              
    `+yssssyssssssssssshysyyssssssssssooohdhmNNmy+-`````-ho/:-...`.+hysmNNNds.```.:o```                                                              
```.sysssssssssssssssssyyyyyhhyso++/:..-smm+sNNmmNdo.```/:``    `.ymNdsmNyhNNh-````/``                                                               
```shssssssssssssssssssssssssyso:.``` `yNNNmmNh--hNmy--+o.```    ommNydNd/+NNNs-:+:.                                                                 
``+hsssssssssssssssssssssssssyyyysso+-:mNNNyhNNhhmmdhssshsooo+++/ymmmhdmdddhhyysoo-`                                                                 
`+yssssssssssssssssssssssssssssyyyyyyyyyyyyyyyyyyyyyysyyyssssssssssssssssssssys:``                                                                   
/hsssssssssssssssssssssssssssssssssysyyyyyyyyysssyyyyssssssssssssssssssssssso+.`                                                                     
hssssssssssssssssssssssssssssssssssssssssssssssyysssssssssyssssssssssysyys/-.``                                                                      
hsssssssssssssssssssssssssssssssssssssssssssyssssssssssssssssyyyyysyyyssys/`` `                                                                      
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssys:``                                                                      
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssyo``                                                                     
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssh/`                                                                     
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssy.` `                                                                  
sssssssssssssssssssssssssyyyyyyyyyyyyyyysssssssssssssssssssssssssssssssssssssydy/``                                                                  
sssssssssssssssssssssssyyysssssssssssyyyyyyyyyyyyyysssssssssssssssssssssyyyyyysyh:                                                                   
sssssssssssssssssssssshyssssyyyyyyyyysssssssssssyyyyyhhyyyyyyyyyyyyyyyyyysssssyy+``                                                                  
ssssssssssssssssssssssdysssssssssssyyyyyyyyhyyyyssyysyyyyssssssssssyyysssyyyhs/.` `                                                                  
hsssssssssssssssssssssyhhhhhhyyyyyyyyyssssssssyyyyyyyyyyyyyyhyyyyyyyyyyyyyyyh+``                                                                     
hysssssssssssssssssyysssyyyysssyysyyyyyyyyhyyyyyyssyyyyssssssssssssssssssssss-``                                                                     
.sysssssssssssssssssyyysyssssssssssssssssssssyyyyyyhyyyyyhyyyyyyyyhhhhysss+:``                                                                       
+sddhysssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssys/.` ``                                                                          
dhhhdhyyyyssssssssssssssssssssssssssssssssssssssssssssssssssssssss+-`                                                                                
hhhhhhdhhyyyhyyyyyysssssssssssssssssssssssssssssssssssssssssso+:.``                                                                                  
hhhhhhhhhhhhhhhyyyyyyyhyyhyyyhyyyyyysssyssssssssssyyyyhhh+-.`                                                                                        
hhhhhhhhhhhhhhhhdhdhhyyyysssssssssssssyyyyssssyssssyyhdhhyo/.`                                                                                       
hhhhhhhhhhhhhhhhhhhhhhhhhhddhhhhyyhhhhyyyyyyyyhhhhdhhhhhhhhhdy/````                                                                                  
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhy+-``                                                                                 
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdNd-                                                                                 
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhdNms:``                                                                             

Name: Anonymous 2012-01-29 16:53

>>22
fuck you faggot

>>1-21
implement it in x86 assembly or die. Using C is undefined behaviour.

Name: Anonymous 2012-01-29 17:18

>>23
http://www.penguin.cz/~literakl/intel/i.html
IDIV - Signed Integer Division

    Usage: IDIV src

    Modifies Flags: (AF,CF,OF,PF,SF,ZF undefined)

One-operand division is PIG DISGUSTING!

Name: Anonymous 2012-01-29 17:49

>>24
Good thing you don't use stack-based archs, you'd have plenty of zero-operand instructions.

Name: Anonymous 2012-01-29 18:12

>>25
I meant one-operand division in a way that's not consistent with the rest of the architecture. I like stack machines and one-argument accumulator machines as long as they're consistent. If a computer uses two-operand instructions for addition, subtraction, and logical operations, a stack for floating point, arbitrarily designed one/two/three-operand multiplication, and one-operand division, it's an ugly piece of shit. Intel's souped up Datapoint 2200 clone does just that.

Name: Anonymous 2012-01-29 18:14

>>26
Who cares, we can work it around in software.

Name: Anonymous 2012-01-29 18:22

>>27
fuck that, the users can work around it

Name: Anonymous 2012-01-29 18:23

>>27
Intel and AMD spend billions on register renaming, out-of-order execution, flag renaming, micro-ops, and floating point stack optimization to work around the limitations of a 70's subscalar accumulator-based register-starved ISA in hardware, and compiler writers and assembly programmers spend time and money on instruction reordering, floating point stack optimization, and spilling registers to stack to work around the limitations of a 70's subscalar accumulator-based register-starved ISA in software. It's the worst of both worlds. It's not high level and orthogonal enough to make life easier for software programmers and it's not simple enough to make life easier for hardware engineers.

Name: Anonymous 2012-01-29 18:49

>>29
compiler writers and assembly programmers spend time and money
Both GCC and clang are free and open source, and their writers didn't get a dime for their work.  Oh and before you bring up nonfree compiler software, I'll just remind you that it is evil and a plague.

Intel and AMD spend billions on register renaming, out-of-order execution, flag renaming, micro-ops, and floating point stack optimization to work around the limitations of a 70's subscalar accumulator-based register-starved ISA in hardware
Nobody forced either them to use that crappy ISA for new designs -- if they lost money cause of their own bad decision, well, tough shit.

Name: Anonymous 2012-01-29 18:57

IF ONLY WE HAD SIMPLE INSTRUCTION SETS LIKE MIPS.


LIFE WOULD BE SO MUCH EASIER

Name: Anonymous 2012-01-29 19:15

>>30
Both GCC and clang are free and open source, and their writers didn't get a dime for their work.
Companies like Red Hat have paid employees working on GCC and Apple has employees working on Clang. But it is also about time. Optimizing for a crap architecture takes time that could be better spent on improved cross-platform compatibility or adding more features (C11/C++11) to the compilers.
Oh and before you bring up nonfree compiler software, I'll just remind you that it is evil and a plague.
Using nonfree BIOS and microcode is an arguably worse plague, since it limits what the user can do with the hardware they paid for (unlocking features, overclocking, disabling forced DRM), but Intel apologists never say anything about that.

Name: Anonymous 2012-01-29 19:22

<-- check em

Name: Anonymous 2012-01-29 19:22

>>31
MIPS is write once, run nowhere (alternatively, run on qemu on x86)

>>32
Using nonfree BIOS and microcode is an arguably worse plague, since it limits what the user can do with the hardware they paid for (unlocking features, overclocking, disabling forced DRM),
Since MIPS is practically dead, I'll only argue that ARM is not yet free of anti-GNU sins as its 3d accelerator still requires binary blobs to run.

Name: Anonymous 2012-01-29 19:27

>>34
All my MIPS programs run in java thus allowing me to run everywher

Name: Anonymous 2012-01-29 19:31

>>34
MIPS is write once, run nowhere
x86 would be the same way if it wasn't for IBM's 30-year-old PC architecture.

Name: Anonymous 2012-01-29 19:54

>>34
I wouldn't use that language to describe the situation. I'd do it like this
Users are not yet completely free to use ARM based architectures as its 3d graphics unit that is provided does not have free drivers or specifications to allow the community to write its own.

Name: Anonymous 2012-01-29 20:07

>>37
That's because you're RMS.

Name: Anonymous 2012-01-29 21:37

>>37
Fuck off, pedant.

Name: Anonymous 2012-01-30 0:04

░░░░░░░░░░░░░░░▄░░░░░░░░░░░░░░░
░░░░░░░░░░░░░▄▀█░░░░░░░░░░░░░░░
░░░░░░░░░░░▄▀░░█░░░░░░░░░░░░░░░
░░░░░░░░░▄▀░░▄▀░░░░░░░░░░░░░░░░
░░░░░░░░█▄░▄▀░░░░░░░░▄█▄░░░░░░░
░░░░░░░░█░▀▄░░░░░░░▄▀░█░▀▄░░░░░
░░░░░░░░▀▄░░▀▄░░░▄▀░░▄▀▄░░▀▄░░░
░▄░░░░░░░░▀▄░░▀▄▀░░▄▀░░░▀▄░░▀▄░
░█▀▄░░░░░░░░▀▄▀█▀▄▀░░░░░░░▀▄░█░
░█░░▀▄░░░░░▄▀░░█░░▀▄░░░░░░░░▀█░
░░▀▄░░▀▄░▄▀░░▄▀░▀▄░░▀▄░░░░░░░░░
░░░░▀▄░░█░░▄▀░░░░░▀▄░▄█░░░░░░░░
░░░░░░▀▄█▄▀░░░░░░░░▄▀░█░░░░░░░░
░░░░░░░░▀░░░░░░░░▄▀░░▄▀░░░░░░░░
░░░░░░░░░░░░░░░▄▀░░▄▀░░░░░░░░░░
░░░░░░░░░░░░░░░█░▄▀░░░░░░░░░░░░
░░░░░░░░░░░░░░░█▀░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░█▄░█░█░▄▀▀▄░░█░░█░█▀▀░▀█▀░█░░░
░█░█▄░█░█░▄▄░░█▄▄█░█▄▄░░█░░█░░░
░█░░█░█░▀▄▄▀░░█░░█░█▄▄░▄█▄░█▄▄░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Name: Anonymous 2012-01-30 2:24

>>33
Since MIPS is practically dead
How hilarious.
Hurr durr. Computer means desktop.

Name: Anonymous 2012-01-30 3:43

>>39
Why? Programming is all about pedantry. Programmers who are not pedantic do not write programs that work.

Name: Anonymous 2012-01-30 11:59

>>41
Hurr durr. Computer means desktop.
This may surprise you, but it does. x86 dominates the personal computer market and ARM has nothing that goes even up to a quarter of its performance.

But since you little western pieces of shit aren't capable of anything, at least the Chinese decided to tackle the problem; personally I'm looking forward to Loongson-3A based laptop as it promises fairly decent performance. I'm going to rape someone in the ass (probably VIPPER, but I'm afraid he might enjoy it) if they only offer 3-cell battery though or if it's over 400$.

Name: Anonymous 2012-01-30 12:06

>>43
you little western pieces of shit
The Intel Jews put DEC and SGI out of business and killed HP's chip division with Itanium hype. Jewtel and Micro$hit bribed PC manufacturers with discounts if they don't offer other CPUs or competing OSes like OS/2. That's the only reason Jewtel crap dominates the PC market.

Name: Anonymous 2012-01-30 12:59

Hurt durr computers are more widespread than embedded systems

Name: VIPPER 2012-01-30 13:32

>>43
Why you wanna rape poor VIPPER?

Also how did this thread devolve into a discussion about CPU arch, i thought we chewed this trough like a million times.

Name: Anonymous 2012-01-30 14:47

>>46
some faggots are questioning x86's supremacy

Name: Anonymous 2012-01-30 14:52

>>47
take your ``ve is beink poisecute'' Jew faggotry to /g/

Name: Anonymous 2012-01-30 18:44

>>44
Nope. You have no proof, only speculation.

>>48
Back to /b/ please.

Name: Anonymous 2012-01-30 22:58

>>22

It's not terribly difficult. It would take awhile of course, and it would help to read up on some of the techniques. protip, start out by making a really fancy c library that'll let you do toy language things in C, and then make an interface to it with byte code and a stack, and then compile code to byte code. And then you're done.

Name: Anonymous 2012-01-31 3:49

I use :colorscheme fnaqevan  after downloading the Vim color sample pack from vim.org.

Also, for terminals, I use something called CSApprox. A Vim hack that makes the RGB based color schemes work with approximate colors on 256 and 88 color terminals: xterm, putty, gnome-terminal, ...

With CSApprox, the key is to use :set t_Co=256 to force it to treat your terminal as 256 color capable one.

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