Skip to content

CAS files convert to C++ in the same way SASS files convert to CSS

Notifications You must be signed in to change notification settings

jeff-hykin/C-with-Awesome-Syntax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

C-with-Awesome-Syntax (CAS)

CAS converts to C++ in the same way SASS converts to CSS

  1. Indentation is used for scoping rather than {}'s
  2. No more ;'s as delimiters

Example

CAS file named hello_world.cas:

    #include <iostream>
    using namespace std
    int main()
        cout << "Hello World\n"
        return 0

The equivlent C++ code:

    #include <iostream>
    using namespace std;
    int main() {
        cout << "Hello World\n;
        return 0;
    }

How to use

If you have a file hello_world.cas, and download the CAS.py file

to print the C++ code, run:

python CAS.py print hello_world.cas

to create a C++ file, run:

python CAS.py compile hello_world.cas hello_world.cpp

to create and run a C++ file, run:

python CAS.py run hello_world.cas

Special cases

  1. Some things like classes/structs need }; at the end. So in CAS put ; at the end of that line, for example:
    class my_class;
        int stuff_in_my_class
  1. Code + //Comment on the same line = problems. For example:
        int a = 5 + 2 // im a comment

   that^ would end up in C++ as:

        int a = 5 + 2 // im a comment;

Which won't run. Currently working on a way to fix this. The best alternative right now is /* comment */

  1. If you really want to split up a line, you can. Just put a \ at the end of the line. Example:
        cout << "hello world\n" + \
            "this is a really long line" + \
            "so I used a \\ to fit it on multiple lines"

Future Support

This was more as a for-fun project. Maybe in a few years I'll make this work properly and release an extension for syntax highlighting for it.

About

CAS files convert to C++ in the same way SASS files convert to CSS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages