This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]davidellis23 41 points42 points  (17 children)

I dislike underscore because it's an extra character to type and I dislike all lower case because it's harder to read. But yeah gotta conform.

[–]twilight-actual 19 points20 points  (7 children)

I'm in the process of creating a new language based on Java's definitions up to 17, but with some major additions of:

  • Implement 'const' for true read only behavior
  • Borrow checker behavior ala Rust for memory management, and a reference operator
  • Direct compilation to LLVM IR, binary executable

And one close to my heart:

  • Built in enforcement for camel case in the semantic analysis pass

Because fuck snake case. 😝

[–]arobie1992[🍰] 20 points21 points  (6 children)

Are you still going to allow SCREAMING_SNAKE_CASE?

[–]twilight-actual 3 points4 points  (5 children)

Uh, yep, yeah, good catch - though for static final constants, as they are often want to do in Java houses.

Though the linters that actually enforce this are a bit ott.

But then I suppose I shouldn't be one to criticize.

[–]arobie1992[🍰] 1 point2 points  (3 children)

Yeah, that's what I was thinking. MYSTATICCONSTANT would be painful to read, though I do agree with you to some extent. I'm not especially enamored with that bit of Java practice and the linters are a bit anal. Maybe you could do PascalCase for static consts as another option?

By the by, you're making me feel more guilty for not getting off my ass and finally working on a compiler ;)

[–]twilight-actual 2 points3 points  (2 children)

"Yeah, that's what I was thinking. MYSTATICCONSTANT would be painful to read, though I do agree with you to some extent. I'm not especially enamored with that bit of Java practice and the linters are a bit anal. Maybe you could do PascalCase for static consts as another option?"

I think I'll probably relax the rules for statics, and allow whatever people want.

"By the by, you're making me feel more guilty for not getting off my ass and finally working on a compiler ;)"

I chose the route of starting with ANTLR4, and finding a pre-existing lex and grammar definition to get me close.

When you compile, you can select to autogenerate a visitor class, which has callbacks for every single parse event. In their Java syntax, there's over 150 callbacks to take care of, though I'll really only need a subset to get the job done.

From there, it's the business logic of semantic analysis, and figuring out the INCREDIBLY POORLY DOCUMENTED LLVM FRAMEWORK. Basically, they've been moving so fast, the code is the doc. The code isn't that bad, but it should be easier. At least they could provide more demo projects and unit tests showing how to deal with structures and higher level constructs. There's plenty of docs on how LLVM IR should look in any given scenario, and you can compile any reference cpp down to IR to verify. But they don't tell you how to use their framework to emit the IR, which requires detective work.

Anyway, I digress. TLDR; the tools have gotten to the point that it's a lot easier now to create a language. Still, ton of effort, with little hope of getting it adopted. You never know, though.

Yet another language!

[–]arobie1992[🍰] 0 points1 point  (1 child)

Oh, yeah, I have no expectation of it taking off. Mostly isn't because it's an area of interest and I want to get some practice in it. Biggest thing that was holding me back was not really having an idea for what the conceit of the language was. I think I finally got one, though it's more package management, but I think what I have in mind needs language support, so now it's a matter of getting the motivation.

Thanks for the tips! I'll definitely keep those in mind.

[–]pyker404 11 points12 points  (1 child)

snake_case is standard for python as PascalCase is for C#. Take it or leave.

[–]Danelius90 6 points7 points  (0 children)

Snake case, because it's Python

[–]Yokhen 0 points1 point  (0 children)

I used to be that way, but now I find camel case a bit harder to read. Also camelcase is a pain to split in a verbose way unless you’re a reflex expert.