[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


Since every programming language is shit, let's make our own programming language.
>>
Let's make Python 2.8, this will make all Python 3.xtards seethe.
>>
I will make the logo
>>
>>108487743
Python but strongly typed: Typethon
>>
I will make the drawPixel(x, y, c)
>>
>>108487724
Make it like assembly; commands and their operands, but in S-expression, so you can nest and metaprogram.
>>
>>108487794
carry my children
>>
Can it has a forth-like stack? Instead of passing arguments and returning values, it's all just there on the stack.
>>
>>108487755
Python with a Python virtual machine, like Java but without mandatory object orientation.
>>
File: 1665316180326732.jpg (77 KB, 900x900)
77 KB
77 KB JPG
anyone who tries to base a new language on python is a homosexual freshie no-code baby duck
>>
>>108487724
i have made a programming language with semantics so vile and unreasonable that no one not even myself can write correct code
this would be impressive if it was deliberate but it was entirely from playing with really dumb ideas
>>
>>108487724
I was thinking you could like just tell it what you want in english and it would basically do that.
>>
>>108487827
no just a streetshitter
>>
>>108487838
based. me too
>>
File: Tohru IDE.png (410 KB, 1920x1040)
410 KB
410 KB PNG
>>108487724
The Dra/g/on Maid Board already has a programming language, and an IDE with a breakpoint debugger. It is called MAIDS. It needs a logo I can use for the icon though, so it isn't just that default Java icon.

>>108487744
See above.
>>
>>108487724
Pascal but Begin/End replaced with brackets
>>
Make it verbose in a way that if anyone tries to train an LLM to vibe code it, he'll waste a lot of tokens for simple things.
>>
no need to make a new language, improve whats already there. for example, ive already pointed out how improve VARGs. heres another thing - initializer, make compiler extension that auto-selects type in union, for example i initialize
{
{"hello-1", TYPE_BOOL, 0}, // => int64_t
{"hello-2", TYPE_INT, 1234}, // => int64_t
{"hello-3", TYPE_STRING, "world"}, // => uint8_t*
{"hello-4", TYPE_DOUBLE, 1.2345},// => double
>>
>>108487794
That's just WASM.
>>
i had an idea of a scripting language where everything was an expression using {} where the last value is returned and you can bind values to variables with let. there is no const and you use 'reset' to rebind an existing variable. having () before the {} prevents execution and makes it a function. i also wanted named lets from scheme so you can add a word in the declaration that can refer to itself. the syntax ()(){} evaluates the expression with the values in the second (). linked lists borrow syntax from haskell and the numeric tower from scheme, and there is no if statement. cond replaces the if statement. here is some pseudo code while i still work out all of the details, is this retarded?
let f = {
let a = 10
let b = 30
reset b = 40
a + b
}

let add = (a, b)
{
a + b
}
let iota = (c)
{
loop (i)(0) {
cond i >= c nil
true i : loop(i + 1)
}
}
>>
>>108488153
How would you distinguish between () meaning the start of a function vs a paranthetical expression + a code block on the next line?

let iota = (c)


This code be misinterpreted as "declare variable iota and set it to the variable c".
>>
LOGO STATUS?
>>
claude

Done.
>>
>>108487724
outdated. the minimal java version is now

void main() {
IO.printin("Hello, World!");
}
>>
>>108488368
It's a green anus
>>
>>108488375
*println
>>
>>108488153
needs goto
>>
File: 1774734102733223.mp4 (2.29 MB, 1068x720)
2.29 MB
2.29 MB MP4
>>108487724
C++ has import std; nigga
>>
File: 20!✨✨.mp4 (1.82 MB, 722x718)
1.82 MB
1.82 MB MP4
>>108487724
Java and C++ are outdated
// Java
void main(String[] args) {
IO.println("Hello, world!");
}

// C++
import std;

int main(int argc, char* argv[]) {
std::println("Hello, world!");
}
>>
>>108488309
that is a good point, i came up with this premise in a few minutes. i basically just wanted to make a scheme without s expressions. i just thought the idea was novel, and i hadn't seen any language do anything like it before. i guess [] could be used for declarations, so this would be valid.
let add = [a, b]
{
(a + b)
{nil}
(a+b)
}
>>
>>108488492
Another idea might be to have a keyword like "fn" or something so the interpretator will know to ignore the linebreak and expect a {} block after the parameter.
let add = fn (a, b)
{
(a + b)
{nil}
(a+b)
}
>>
>>108488417
That's a man.
>>
File: logocaml.gif (5 KB, 375x352)
5 KB
5 KB GIF
I heard Rust used OCaml before bootstrapping their compiler. Anyone on /g/ familiar with it? How hard is it to learn?
>>
can we call it "Jaiva"?
>>
>>108488824
How do you pronounce that? Jave-ah? Jeye-vah?
>>
>>108488854
second one
>>
>>108487724
>/lit/ has written multiple books
>even /prog/ did something memorable with sleepsort
>/g/ has never done anything of value
>>
>>108489413
/g/ got a bunch of itoddlers to microwave their iphones and created C+=
>>
>>108489875
C+= what? That's an incomplete statement.
>>
abstract assembly with integrated ai assistance
>>
list comprehensions are a non-starter. naked returns are a bad feature and shouldnt be a thing. a keyword for threading like
go <bullshit>
would be nice, but requires gc, which is also a nonstarter. imports should be relative to the filename if not std, and relative to the installation dir if a system package. c-like syntax would be nice, but conditions shouldnt need to be wrapped in parens. rubys
<int>.times
are pretty goated and should be first class https://apidock.com/ruby/Integer/times
>>
>>108487896
>I was thinking you could like just tell it what you want in english and it would basically do that.

That doesn't work. When you take advanced theoretical computer science courses, you learn that the number of possible computer algorithms you can program with a computer programming language is contained in an infinite set with the cardinality of whole numbers.

And the number of possible sentences or paragraphs you can create with the English language is an infinite set with the cardinality of real numbers.

Or in other words, the set of English language descriptions of computer algorithms is much larger than the set of possible computer algorithms.
>>
>>108490116
Think about it this way: The English language is not finished. They add or create new words and phrases every year.

How would you create a non-closed programming language?
>>
>>108490116
I don't care about that boring math stuff. You can tell a person to do something and he'll do it. Computers are supposed to be smart so I don't see why that wouldn't work.
>>
>>108487724
This is the syntax I would like to try is.
I'm using llvm but have probably only done half of the work to be able to compile this.
I'm aware $ is bad for foreigners but whatever.

fn fib(n : i32) : i32
pre (n > 0, n < 100000)
post (n > 0) { //contracts
if (n == 0 || n == 1) { return n; }
return fib(n - 1) + fib(n - 2);
}

fn populate(n: i32) : Array<i32> {
array : $Array<i32> = new Array<i32>(n); //$ is for mutable, default (nothing) is immutable
loop (i : $i32 = 0; i < n; ++i) {
array[i] = fib(i);
}
return array;
}

fn main() : i32 {
array : #Array<i32> = populate(10); //# is for compile time eval
println(5);
println(10);
return 0;
}
>>
>>108487794
>it’s another “dipshit reinvents Lisp because he doesn’t know Lisp already does that” episode
>>
>>108487963
M-AIDS
>>
File: 1769726928180.gif (268 KB, 393x450)
268 KB
268 KB GIF
>>108490355
Why are you making Array a library type rather than just part of the language? Just make it i32[] like Java, C#, Rust, and everyone else who is not a retarded nigger like Bjarne.
Also, why are you making pre/post come after the parameter list and before the braces? That basically forces you to use Allman brace placement which sucks ass.
And why put println in the global namespace, why not put it in std::io or be like Java and C# and have an implicitly imported class for calling I/O functions?
And, why label a for loop as "loop" when it already has a clear established name?
>>
>>108490854
not to mention the use of "new" without a delete, maybe there is a runtime... or maybe everything heap allocated is reference counted. also : instead of = seems like we are changing things to just change them.
>>
destructors?
>>
>>108490911
Well, I assume they did not pair with a delete because they intended to return an array pointer, but it was not clear at all from the return type that it was a pointer or reference, perhaps it is just a language-level enforcement of the Rust-style factory method (often called new), and I personally would prefer to have Rust style management over C++
>>
>>108490854
>Also, why are you making pre/post come after the parameter list and before the braces? That basically forces you to use Allman brace placement which sucks ass.
Agree. If it were up to me I would make contracts specified in annotations, which would appear before the function signature like in Java.
>>
>>108490948
hes only half way done with the work to compile the sample code and hasn't fleshed that out yet.
>>
>>108490355
If you are going to use trailing return types for function signatures instead of C-style signatures at least use -> instead of colon for the return type.
>>
Thanks for all the feedback.
I only implemented if statements yesterday and am finding out things about llvm every time I work on it. So claiming that I'm half way might be generous.
I hope I don't abandon this project.

>>108490854
>Why are you making Array a library type rather than just part of the language?
I'm kind of used to it after using CPP.
Why should array be more than just a library type?
>Also, why are you making pre/post come after the parameter list and before the braces?
Just feels like it reads more sequentially. Feels weird when there's comments before the function header to me for the contract.
>Allman
I use k&r in my example. Which is what I prefer.
>Println
I do agree with you that is better. I'll change it.
>Loop
I want to try having postconditions in loop syntax as well. Golang didn't take it far enough.
loop ([initialiser]; [precondition]; [increment]) {
... Loop Code
} ([postcondition])

I'm not sure how to do the end brace postcondition part with my current parser since it'll think it's a grouped expression.

>>108490911
>new
This can for sure be better done. I haven't thought about it yet.
> :
This is a standard type indicator

>>108490948
It was supposed to be a reference.

>>108490970
That's a good idea. I like that. Originally I had no demarcation but it looked messy if I had the pre and post conditions there too.
>>
We should make an interpreter that creates C code out of pseudocode.
>>
File: 1772574698974446.jpg (62 KB, 1080x1080)
62 KB
62 KB JPG
>>108487724
I'll have one F#, sans .NET, please.
>>
it should lack all branching functionality for performance purposes
>>
>>108488432
>Java and C++ are outdated
True. Use a modern language instead.
>>
>>108489413
Didnt that encrypted messaging protocol/app come from /g/, cant remember the name, never used it, but people did
>>
>>108491814
>F#
>significant whitespace
Disgusting.
>sans .NET
Just use OCaml.
>>
>>108491910
>>significant whitespace
Yes, done correctly to improve the syntax
>Just use OCaml.
F# has a far superior design; it's just crippled by .NETisms.
>>
File: 1716717642372091.webm (4 MB, 2040x2040)
4 MB
4 MB WEBM
>>108490355
>fn
>>
>>108487794
>nesting in assembly
Sure buddy
>>
>>108491814
Sorry, .NET machine broken.
>>
>>108487963
I like the idea of maids but what does it do, just character sheets?
>>
Where is the 'everything is a linear equation' language
>>
File: wizard.jpg (23 KB, 600x600)
23 KB
23 KB JPG
strongly typed pseudocode
>>
>>108493496
why wouldn't this work
>>
>>108493509
((((((((())))))))))
>>
>>108487724
C, but with classes
>>
>>108491129
>I'm kind of used to it after using CPP.
std::array<T, N> was tacked on last moment because they needed an abstraction over C arrays without making changes to C arrays which would break compatibility
arrays and tuples are such fundamental parts of a language that they ought to be baked into the language rather than a library type in my opinion
>>
anyone got the ebonics c picture?
>>
Python but strongly typed and with tagged unions, also a special sum type for errors: when you have multiple errors in one block, they will get added together into an error type that's unique to that block or function.

Example:
enum Num:
Float(f64)
Int(i32)

error MathError:
DivideByZero(Num)

impl Num:
def to_float(self) -> f64:
match self:
case Float(f):
return f
case Int(i):
return f64(i)
def to_string(self) -> str:
match self:
case Float(f):
return "${f}"
case Int(i):
return "${i}"

def divide(a Num, b Num) -> Num!MathError:
let b = b.to_float()
if b == 0:
raise MathError.DivideByZero(a)
let a = a.to_float()
return Num.Float(a / b)

try:
let a = Num.Int(1)
let b = Num.Int(0)
print(divide(a, b)?.to_string())
except e:
match e:
case MathError.DivideByZero(n):
print("Cannot divide ${n.to_string()} by 0")
else:
print("Unexpected error")
>>
>>108493773
So... a shitty version of Nim?
>>
>>108491952
>F# has a far superior design
May I see it?
>>
What language are u making the compiler in?
>>
>>108493812
Nim minus the macro bullshit.
>>
>>108493930
OCaml
>>
>>108487724
true = yes
>>
>>108487838
post it i want to see what kind of clusterfuck that is
>>
>>108493529
turbokikes?
>>
>>108493529
((((((((()))))))))) == ()
>>
>>108487812
Technically, it already has a VM, though it's quite different from something like JVM. What issues do you have with the current execution model?
>>
>>108493997
nitrokikes
>>
maybe<int> x = 5 | 7 | 9;

let y = 10;
y += future(y, +2);

fn area(width, height, result) {
result = width * height;
}
area(5, ?, 20);

precise<float, halflife=100> pi = 3.14159265359;

let a = 5;
let b = entangle(a);
a = 10;

do {
x += 5;
y *= 2;
} undo;
>>
File: 1774976288640.png (926 KB, 983x764)
926 KB
926 KB PNG
>>108494101
what the fuck am I reading...
>>
>>108494132
fn pythagorean(a, b, c) {
a2 + b2 = c2;
}
pythagorean(3, 4, ?);
pythagorean(?, 4, 5);

let x = 5;
x += 10;
x *= 2;
rewind(2);

if (maybe) {
print("happens");
}

let state = |0⟩ + |1⟩;
observe(state);

alloc x = [1,2,3];
dealloc x;
>>
File: 1660320444392.gif (832 KB, 341x450)
832 KB
832 KB GIF
>>108493453
The language has universal computation and homoiconicity. You can do anything with it, and you can metaprogram in it. That particular example program just makes Maid character sheets. I am working on another that shows how to make and use some basic data structures.
>>
>>108494043
Nope. There's a big difference between (you) and (((them))). Except maybe for you in particular, but generally, they mean different things.

We should incorporate this distinction in the language.
>>
>>108494453
I see it the opposite way. Tuples should always destruct to a 1D data structure. Then putting tuples next to each other would be the same as concatenation.
f(1)(2)(3) = f(1, 2, 3)

You can write functional patterns more elegantly this way, like calling a function returned from another function.
>>
>>108494639
You're looking for elegancy. I'm looking to fuck people up.
We are not the same.

That said, your idea does look cool.
>>
>>108491881
tox? did anyone ever use it at all?
also, who the fuck would be retarded enough to trust a "secure" messaging app that started development in 4chan?
>>
>>108494639
Could you show some use-cases for this?
>>
>>108487724
python is a scripting language not a programming language
>>
apl but left-to-right
>>
File: hit.webm (227 KB, 696x352)
227 KB
227 KB WEBM
>>108495381
>>
File: cute_dance.gif (1.56 MB, 568x640)
1.56 MB
1.56 MB GIF
>>108487724
1. Take the V8 Javascript engine.
2. Fix language mistakes.
3. Add nice features from other languages.
4. Make sure 3 and 4 don't trash performance.
5. Stop if perfect.
6. Goto 2.
>>
>>108495257
You could have lazy parameters similar to functional programming languages but with a more conventional syntax.
def add int -> int -> int:
param a
param b
return a + b

sum = add(1, 2)
assert(sum == 3)

add_one = add(1)
next_num = add_one(sum)
assert(next_num == 4)

Think of "param" here as being like "yield" but instead of giving a value, it takes a value from the stack and returns a function that takes one less argument. Because (1)(2) == (1, 2), calling add(1, 2) is the same as add(1)(2), so it calls the whole function and returns the result. You can also split the function. Here, "add_one" is "add" but with its first argument locked to 1. And because they're lazy, each parameter doesn't run until the function needs it.

Another way to write it would be like this:
def add():
def add_p1(a):
def add_p2(b):
return a + b
return add_p2
return add_p1

sum = add()(1)(2)

This achieves the same effect, but the other way is easier to read.
>>
>>108495888
Why V8? It's like 10 times larger (or more) than luajit, and luajit (in some cases) outperform it.
>>
>>108494639
What if I want to pass a tuple as an argument
>>
>>108496472
If a Tuple can contain another Tuple, then anon has basically reinvented S-expressions with a worse syntax, which is impressive as I did not think it was possible to make a worse syntax.
>>
>>108493651
if there was something which was c but where each c file was its own scope would be pretty much ideal to me
i dont even necessarily need 'classes' or any of the acrobatics that comes along with it, i just want a slightly cleaner way of managing token names etc.
>>
>>108495888
Any language that targets webassembly can make use of v8 already. Usually better than JS because the engine won't have to add "but what if the user fucked with some prototypes" slow paths everywhere.
>>
>>108496472
It would spread into the parent tuple
((1, 2)) -> (1, 2)

Basically, all combinations of tuples turn into a 1D tuple.
((((1,2)),(3,4)),5)(6,7)(8)(9) -> (1,2,3,4,5,6,7,8,9)

This can also work backwards though: you can take a slice out of any tuple and get a smaller tuple.
>>
>>108496511
You might like this: https://c3-lang.org/
>>
File: cailee-0.jpg (195 KB, 540x540)
195 KB
195 KB JPG
>>108496814
>fn
>>
>>108497120
Would you prefer "def"?
>>
File: cailee (10).jpg (25 KB, 736x414)
25 KB
25 KB JPG
>>108497162
I would prefer 'function' or 'define'. There's no point in using odd abbreviations in 2026.
Visually parsing a larger token is not harder than parsing a shorter one. The visual cortex doesn't work in that way. On the contrary, a larger token is easier to recognize because it contains more information. However, CHUDs might disagree with this view that is why modern languages are plagued with odd keywords.
>>
>>108496803
So it wouldn't be possible for a function to operate on a tuple of variable or unknown length?
>>
>>108497590
No, but you could use something else like a struct or an array.
>>
>>108497318
Woah, we got Mr. Verbose here.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.