[ / / / / / / / / / / / / / ] [ dir / cafechan / cutebois / had / marx / shota / tacos / vichan / zoo ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Email
Comment *
File
Select/drop/paste files here
Password (Randomized for file and post deletion; you may also set your own.)
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

[–]

 No.949041[Watch Thread][Show All Posts]

I present to you a new, user-friendly stack-based language, 0-Lang. It's designed to be easy to read, as little keystroke as possible, self-documenting, verbose language.


5 \ puts integer on the stack
5.0 \ puts decimal on the stack
'Hello' \ puts string on the stack

drop * \ drops the string from the stack, multiplies the integer,
\ gives of error as * works only on numbers of the same type

5 \ puts integer on the stack
6.0 \ puts decimal on the stack
decimal-to-integer * \ leaves 30 on the stack

5 \ puts integer on the stack
6.0 \ puts decimal on the stack
swap integer-to-decimal * \ leaves 30.0 on the stack

[ fibonacci \ n -> m
duplicate 0 = if else
duplicate 1 = if else
duplicate 1 > if duplicate 1 - fibonacci swap 2 - fibonacci + end end end
]

\ span syntax: 'limit index step'
\ index puts the current loop index on the stack
\ print-format string takes in two arguments: the format string, and the number of format arguments
\ e.g. if i want to print two numbers, i have to do: 1 1 '`i `i' 2 print-format-string
\ format string formats start with a backtick, examples:
\ `i - integer
\ `d - decimal
\ `s - string
\ `n - newline
\ `t - tab
[ n-bottles-of-beer \ n ->
0 1 span
index index
'`i bottles of beer on the wall. `i bottles of beer. Take one down, pass it around,`n' 2 print-format-string
end
]

 No.949055

looks like the retard son of python and haskell


 No.949064

Given a file named hello.c with the following contents:

int main(int argc, char **argv)
{
printf("Hello world!\n");
return 0;
}

one could use the following TECO session (noting that the prompt is "*" and "$"
is how ESC is echoed) to change "Hello" into "Goodbye":

*EBhello.c$$ Open file for read/write with backup
*P$$ Read in the first page
*SHello$0TT$$ Search for "Hello" and print the line (pointer placed after searched string)
printf("Hello world!\n"); The line
*-5DIGoodbye$0TT$$ Delete five characters before pointer (ie "Hello"), insert "Goodbye", and print the line
printf("Goodbye world!\n"); The updated line
*EX$$ Copy the remainder of the file and exit

These two example programs are a simple interchange sort of the current text
buffer, based on the 1st character of each line, taken from the PDP-11 TECO
User's Guide. A "goto" and "structured" version are shown.


 No.949101>>949105

Why not use forth?


 No.949105>>949136

>>949101

Unclear syntax, little useful abstractions, confusing at times, EXTREMELY confusing string manipulation, etc.


 No.949131>>949136

Have you tried Forth?


 No.949136>>949848

>>949131

Yes. Read >>949105.

Doing anything useful, i.e. anything apart from embedded is extremely hard.


 No.949149>>949163

I'm personally working on a similar project, I mentioned it breifly in another thread. A purely functional stack based language with static typeing shallow binding arrays[1] and primitives for chunking data structures into peices based on preproccessor commands like @cache-line-length, @simd-lanes, @logical-cores, etc. Also explicit inlining and cache prefeching @prefetch @inline, I've got some ideas for syntax but I don't want to get into it. Needless to say from the other thread ergonomics is a priority as is homoiconism.

I'm also looking into "goal-directed" control structures[2], lazy futures to allow for infinit datastructures and optimisation, aswell as some sort of concurrency model, maybe even a partitioned global address space[3], although I don't know enough to pich one let alone implement it. Whole things based primarily off of Joy[4], and Kitten[5].

It's going to be a little while before I can even really develope very much of it, but the plan is to start out with a simple metacircular compiler bootstraped off scheme when I finish SICP and then head off to the dragon book filling out the feature set along the way.

[1] http://home.pipeline.com/~hbaker1/ShallowArrays.html

[2] https://en.wikipedia.org/wiki/Icon_programming_language#Goal-directed_execution

[3] https://en.wikipedia.org/wiki/Partitioned_global_address_space

[4] http://www.kevinalbrecht.com/code/joy-mirror/joy.html

[5] http://kittenlang.org


 No.949151

APL for brainlets


 No.949163>>949168

>>949149

Making a stack-based lang really doesn't require much parsing, tbh.


 No.949168>>949187

>>949163

true, parsing is the easiest part of language implementation though, making something to handel types and type interance aswell as optimisations like Sparse conditional constant propagation take a second to get setup. It you don't beleive me take a look at Factor's compiler.

Mostly I just like to finish a project before I start another, Im on 512 of sicp so wont be much longer.


 No.949169>>949187 >>949198

Yaaay, another language designed with people who can't program in mind, just like the other ten dozens that came out last week.


 No.949187

>>949168

I really like Joy. I've never heard of it before, but it's extremely interesting.

>>949169

Are you another C-tard?


 No.949198>>949808

>>949169

If you're not implementing several DSLs to solve your project, then you're not programming properly. Go back to coding with a bar of soap on a mirror.


 No.949748

bumb


 No.949761>>949762

Just use Retro Forth you fucking faggot


 No.949762

>>949761

Retro Forth, or Factor. Factor is really annoying learning USING: includes and shit, but it's great.

But use Retro Forth.


 No.949808

>>949198

not him, but whats the reference of the bar of soap on the mirror?


 No.949848

>>949136

a 3kb weight is "extremely heavy" to some.

fail over to http://www.oforth.com/




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
18 replies | 0 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / cafechan / cutebois / had / marx / shota / tacos / vichan / zoo ][ watchlist ]