ChubakPDP11

joined 9 months ago
[–] ChubakPDP11@programming.dev 2 points 8 months ago (2 children)

Is parenscript some sort of s-expression JS?

[–] ChubakPDP11@programming.dev 2 points 8 months ago

Cool, I am making a second version were things are cleaner, I will add digraphs, trigraphs and preprocessor directives to the gramamr as wel. Thanks.

[–] ChubakPDP11@programming.dev 1 points 8 months ago

I think any ML-based lanuage takes the cake. Like SML, OCaml, etc. These languages are really fluid.

I think Rust would look 'good' if there was an EBNF grammar for it but all there is are the psuedo-EBNF notations in the specs.

[–] ChubakPDP11@programming.dev 1 points 8 months ago

You're right yeah. Hand-implementing lexers and parsers is kind of 'inane'. I'm not saying it's stupid. For a small grammar it makes sense. But for a big grammar, just use a PEG generator, or Yacc/Lex. Rust has Lalrpop and Java has ANTLR. There's truly no need to implement a parser from scratch. But people on the internet really seem to think using lexer and parser generators 'limits' them. There are some hacks involed in most Lex/Yacc or PEG specs, but at the end people should keep in mind that LR parsers MUST be generated!

Maybe implement the scanner? Even that is kinda stupid. Unless you do what Rob Pike says: https://www.youtube.com/watch?v=HxaD_trXwRE

[–] ChubakPDP11@programming.dev 1 points 8 months ago

Cool! I will make it.

[–] ChubakPDP11@programming.dev 2 points 8 months ago (4 children)

I think digraphs and trigraphs are part of the preprocessor? I did not add any preprocessor stuff to this grammar. I am adding them to the new version I am working on.

I have read the C17 standard fully and I did recall it from memory from time to time but it seems like I had forgotten a lot of stuff. I am redefining it, and I am redigning my AWK grammar too.

I am hoping I could perhaps make a Github pages website called Internet Grammar Database and have all sorts of grammar inside it. Thoughts?

[–] ChubakPDP11@programming.dev 1 points 8 months ago

Not with this grammar. There's this parser-generator-immedate called BNFC that uses it's own flavor of BNF (Labeled BNF) to generate Yacc/Lex (or ANTLR when can), an abstract syntax tree, etc, but I don't like it. There are no EBNF parser generators AFAIK. One could, possibly, feed this to ChatGPT and ask for a Yacc/Lex pair in return, or even a manual parser! I may do that, but I first have to clean this up and add stuff that aren't there.

ChatGPT has changed langdev a lot for me. I automate a good portion of the processo with it. But one needs solid specs to feed to it.

As I said I wish to implement the frontend myself, basically the lexer/parser. But I kinda get bored with LP because it's too time-consuming. Plus LR(1) can only be generated, it's only LL(1) which can be hand-written. I have not decided yet. I wish to focus more on the backend, because that is where you can do innovative shit and perhaps, write a paper on it.

Also, I'm going to leave C23 to people who have years of experience. ANSI C is the lower denomniator of C. I am using C99 standard, which should be able to compile a good portion of code bases. C99 is the last required POSIX standard for C. That's when C went under ISO.

Thanks.

[–] ChubakPDP11@programming.dev 1 points 8 months ago

Uh this one was back of my mind. Thanks!

[–] ChubakPDP11@programming.dev 1 points 8 months ago

Thanks man, also noted your advice.

[–] ChubakPDP11@programming.dev 8 points 9 months ago

I'm not gonna, Mr. Biden. Make me. Rust is for morons. C++ too. I only code in C.

view more: ‹ prev next ›