[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]


Aloha, Salaam, Dorud, Bonjur and Hello. I'm currently making an Awk to C compiler in OCaml:

https://github.com/Chubek/Awk2C

It won't be just a dumb, naive compiler. It has a runtime which is statically linked to the executable (I'm still ruminating on the runtime, but the prototype I generated with Qwen3 Coder seemed very small). It also does control and data flow optimizations. I won't be doing any SSA because it's stupid, and the C compiler will handle that. I'm just doing small stuff here and there like strength reduction, constant propagation, loop-related optimizations and coming up with Awk-specific optimizations like, when someone uses an ERE for any operation, that could be done via simple string comparison. If you can think of any other Awk-specific operations, lemme know.

Also, I won't be supporting GNU superset, they are extremely interpreter-specific.

I'm going to add several things that will be compiler-, specially C-specific, e.g. storage classes (static/extern).

I might add hashtable literals too, but only for initialization. Literally name one compiled-only language that has hashtable literals. It's undoable in a compiled language.

As for memory management, I'll use a simple arena allocator in the runtime.

If you got any questions, ask. Also, suggestions for features are welcome.

Watch/Star the repo.

Merci, Tashakor, Origato and Thanks.
>>
>>106670048
Niggerlicious.
>>
>>106670391
4chan is for people older than 18, and people who live in [current year]. You seem to be a 13yo from 2010 so beat it.
>>
>>106670048
awk tuah
>>
>>106670546
grep on that thang.
>>
>>106670048
That syntax looks so retarded. Who made it?
>Ohh just add a horizontal bar and keep it aligned and that is a fucking block
Fucking morons.
>>
Damn you have a lot of repos
I assume your goal is getting hired, don't you think at some point too many projects is a red flag?
>>
>>106670647
It's OCaml. Yes, OCaml looks like Yacc. Because OCaml is based on ML (Meta Language) and ML itself is based on the BNF/EBNF notation. BNF itself is based on logical notation. In logic, vertical bar is used for things like "this set is constructed for the following...".

[code
A = { x | x is a member of N }
[/code]

This notation is closely used in Haskell's list notation.
>>
>>106670679
Most of those are unfinished projects. Check out my Github front page (github.com/Chubek). I have listed all the notable projects, and enumerated the ones that I've terminated, and the ones that are finished.

Also, no, my goal is not employment. I don't have a degree, so no one is going to hire me. I just code for my enjoyment.
>>
>>106670704
I never liked BNF/EBNF, IMHO Wirth's syntax notation is better but I prefer railroad diagrams. I think we need to get rid of textual forms to describe syntax, or logic, the text is very limited.
>>
>>106670647
Also, it does not mean a 'block' per se. It mostly means 'or'. That's how ML languages like OCaml denote variants, which are based on Algebraic Data Types. AGDTs are based on type theory, "sum types" and "product types" which could be combined.

This OCaml code:

type foo = 
| Bar of int
| Fizz of string
| Baz


Is equal to this Rust code:

enum Foo {
Bar(i32),
FIzz(String),
Baz
}



Is equal to this C code:

struct Foo {
enum {
Bar,
Fizz,
Baz
} type;

union {
int bar;
const char *fizz;
} as;

};


What this is a "sum of product" type.

I made an implementation of Zephyr ASDL, which uses type theory to denote the Abstract Syntax of a program, later generates a C program to be used as the AST of a language:

https://github.com/Chubek/ZephyrASDL
>>
>>106670742
Railroad diagrams are only useful for lexical syntax, though. You could do phrase structure with them. But it'll come out unintelligible.

PEG is better than all of them.
>>
>>106670679
generally speaking, people like OP do not make money in the field of programming
it sucks the soul from them
if they do, it might be from a company they launch or whatever
>>
>>106670776
I enjoy programming, that part is false. But the other thing you said is true. I wanna use my father's Veteran's fund to launch a SaaS startup. Because I'll code everything myself, I'll save up a lot on the software. And I'll use AI for support. Wrinkle-brain scheme.

What sucks the soul out of me is webshit. I absoutely despise web and I don't approach it with a 2000 kilometer aluminum stick, otherwise, I'll get webdev AIDS.

People complain that they got no job, but, buddy, all you can do is make React code. You did not grow your skillset when you could have. It's on you.

I worked with an Indian company as a frontend developer for 2 months, and it fucking destroyed me. All I gave them was garbage code anyways, because I just don't WANT TO learn webdev.
>>
>>106670821
I pray that you continue to enjoy programming
>>
>>106670842
Aye.



[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.