I need Your opinion on this simple source to source compiler in Rust. Please

Hey everyone!

So I've been working on this language I call Bob that compiles into C++ code and then compiles that into binary code with a g++ shell command. I started pretty recently and haven't yet got an opinion from any smart people, and that's why this post exists.

I've tried to make the syntax of Bob as close to that of a human language, English, as possible. And I believe I've done it in a way that doesn't compromise a lot of the functionality you get with traditional programming language syntax. The basic syntax of Bob is summarised as follows -

  1. Terminology - Each statement, as they are called in a traditional language like C++, is called a sentence in Bob. Each function name is called a verb. The verb (function) arguments, except the first one, have an argument name, each called an assisting verb (or something like that. I haven't got to multiple arguments yet.).

  2. Every sentence begins with a call to Bob to make the language feel more natural. This part may be automated with an appropriate IDE. A verb must follow the call to Bob. There are no statements in Bob that do not begin with a verb. Even an assignment operation is considered a verb in Bob and implemented in such a fashion.

  3. Expressions are arguments to a function that are evaluated before being used, like other languages. (But as is obvious, implementing expressions is not very straightforward.)

  4. Comments in Bob go in between brackets. (They currently don't work on a separate line by themselves)

  5. Since each sentence terminates with a period, Bob code snippets can be written as paragraphs. (Doesn't work right now. Each sentence must be on a new line.)

Technical aspects of Bob -

  1. All possible run time errors that come with using a language like C++ are avoided with an errors system that verifies things like data types before the C++ code is generated. For example, when reading an integer from stdin, entering types like char prompt the user to enter a number.

  2. I will soon write a graphics pack (That's what modules are called) for Bob using the C++ SFML library. There is definitely some ground work to be covered before though. I think, after looking into such possibilities, that Bob can be used to make easy to use abstractions of such libraries easily. For example, one could implement a platform game making API with Bob using SFML quite easily.

  3. A lot of the redundant code (should I say boilerplate?) that makes a language like C++ or Rust look overwhelming to a beginner is abstracted away.

  4. The same system may be used to trans-compile to other languages like JavaScript as well, opening a lot of possibilities for educating beginner programmers.

I'd like to know your opinions and also if you think this is viable. I've tried documenting things as I go so things should be pretty easy to understand and review. Check out the GitHub repository at https://github.com/actuday6418/bob.git. Be advised, I'm not done yet. Expressions work only with write or write_line as of now. This is written in Rust, btw.


Have you run rustfmt & clippy on the code? It seems that your code uses nonstandard formatting in many places, and some things should be flagged by clippy (e.g., byte as char == '"').

I'll do that. Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.