Interpreted language
data | ||
examples | ||
codes.sko | ||
daysleft.sk.sko | ||
feesh.sk.sko | ||
readme.txt | ||
skrip.c | ||
skripc.c | ||
sort_output.txt | ||
sort.sk.sko |
############################################ # Skrip compiler and bytecode interpreter # by Corey Dunn aka pvtroswold aka crosd # # Below is probably where I should describe # the language and stuff. # # 14 Jan 2018 - 17 Feb 2018 # (Slightly updated 18 June 2019) # ############################################ Pretty much a bad version of C (actually closer to the untyped B language), with a very very horrible bytecode encoding + "virtual machine" Skrip wants to do what MS-DOS let programmers do: access the hardware easily from assembly-level (or compiler-generated instructions), using interrupts or 'system calls' at a low level to make doing things like graphics and user input consistent and independent of included libraries. The reason MS-DOS (and other systems like Commodore) could do this was becuase the hardware wasn't as modular as today's computers. Modern solutions to this problem are to use virtual machines like Java or .NET. Will we ever have something as efficient and simultaneously as elegant as the older solutions? Skrip wants to be that. (but it's very very very not that. At all. But maybe we can all learn from its optimism?) Declarations: [Keyword]------[Example]-------------[Description]----------- var var count; func func add {ret;} Parameters passed through vars array array arr 64; Incorrect: var arr[64]; ------------------------------------------------------------- Operators: [Operator]-----[Example]-------------[Description]----------- + x=x+1; Result is discarded - x=x-1; < if(x<16) Boolean comparison > if(x>32) (should be unsigned) = result=512; Assignment : if(result:1024) Equality # #this is a comment Comment, endline-terminated "" "string" Returns pointer [] arr[1] Offset and dereference * x*128 Multiply (not dereference) / x/128 Divide % x%256 Modulus ! if(x!) Logical not (post-fix) & if(x>8 & y) Logical and | if(x! | y) Logical inclusive or ------------------------------------------------------------- Keywords: [Keyword]------[Example]--------------[Description]----------- asm asm 39; Insert Skrip opcode by decimal value (operands passed in r4x,r5x,r6x) r4x r4x str_msg; asm 39; Load to r4x r5x r5x 16; Load to r5x r6x r6x "a string!"; Load to r6x r2x result=r2x; Load *from* r2x (often return value from insns) while {i=i+1;}while i<len; Always do-while loop if if(i:len){str="done";} Control flow, yeah -------------------------------------------------------------- Other things: [Other Thing]-----[Example]-------------------[Description]----------- Function call function_name; No ()s, so use vars for parameters Variables var a;var b;var c; All vars are global ret; behavior func f{}func g{f;ret;} f will fall-through to g (infinite loop) String literals string="hello there"; Generates dynamic memory (so try to minimize use) How to compile .\skripc <file.sk> Output: <file.sk.sko> How to run .\skrip <file.sko> Or you can reroute output: .\skrip <file.sko> > <file> Tigr You can probably remove the Tigr dependency if you have the patience Source I think this was written with gcc (but you most certainly won't want to read that mess) ---------------------------------------------------------------------- Notes: Hello, this is where notes go. If you find them, let me know, so that I can put them here, in the notes section, where notes are supposed to go. Skripc doesn't make an effort to give many error/warning messages (it has been primarily a personal project). There's no unary negation operator.