Like Tree2Likes
  • 1 Post By suncore
  • 1 Post By Mario F.

Cero

This is a discussion on Cero within the Tech Board forums, part of the Community Boards category; Hi all! I've created a small flavour of C++ called Cero. I find it useful and would just like to ...

  1. #1
    Registered User
    Join Date
    Mar 2014
    Posts
    3

    Cero

    Hi all!
    I've created a small flavour of C++ called Cero. I find it useful and would just like to share it, maybe you will too. Cero is basically C++ without semicolons and curly braces, plus some additional stuff.
    See http://cero-lang.org

    Thoughts?

    -- Henrik
    manasij7479 likes this.

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Why did you decide to modify C++ and not design a general purpose language from scratch?
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,231
    No header files
    O_o

    Code:
    +++ public
    +decl
    +++ private
    #include <iostream>
    #include <string>
    +void myprint(std::string s)
        std::cout << s
    If you are going to "bake" header files from `import' statements and the `ce' file, you should handle include files as `import'.

    If you are correctly handling forward declarations on behalf of the client, you can use the same juice to eliminate the need for `+++ public' and `+++ private'.

    Code:
    +++ public
    +decl
    +++ private
    In other words, you may assume the above unless otherwise stated.

    No curly braces and semicolons - some exceptions
    Why not "overload" "null assignment" for that context? The expression would be familiar to Python, Javascript, and several other programmers.

    Code:
    void fun() = null;
    You'll also find relatively few contexts where brace initialization occurs in C++11, and if you don't consider "in-place" contexts you can easily parse comma-delimited lists allowing a client to forgo the braces if they put everything on a single line.

    Breaking long lines
    A line beginning with a unique operator may be parsed no differently from a line ending with a unique operator.

    Why did you decide to modify C++ and not design a general purpose language from scratch?
    Can't be done; programmers are doomed to repeat the mistakes of earlier languages.

    People shape the world with tools, but the tools inevitably shape the wielder.

    Soma
    Last edited by phantomotap; 03-02-2014 at 09:52 AM.
    “Often out of periods of losing come the greatest strivings toward a new winning streak.” -- Fred Rogers
    “Salem Was Wrong!” -- Pedant Necromancer

  4. #4
    Registered User
    Join Date
    Mar 2014
    Posts
    3
    Quote Originally Posted by manasij7479 View Post
    Why did you decide to modify C++ and not design a general purpose language from scratch?
    C++ as a base is good enough for me, but I wanted a few minor changes to the syntax. Also, the effort involved in designing a new language is huge.

    -- Henrik

  5. #5
    Registered User
    Join Date
    Mar 2014
    Posts
    3
    Quote Originally Posted by phantomotap View Post
    <No header files>
    If you are going to "bake" header files from `import' statements and the `ce' file, you should handle include files as `import'.
    The idea is that 'import' imports Cero files and #include includes C++ files. I think it's good to keep them apart.
    If you are correctly handling forward declarations on behalf of the client, you can use the same juice to eliminate the need for `+++ public' and `+++ private'.

    Code:
    +++ public
    +decl
    +++ private
    In other words, you may assume the above unless otherwise stated.
    The idea with "+++ public" is that you put everything to be exported in that section. That way you don't have to put "+" on every little thing to be exported. That method can be used for e.g. exported functions where the function definition header can be reused/copied to the +decl statement.

    <No curly braces or semicolons - some exceptions>
    Why not "overload" "null assignment" for that context? The expression would be familiar to Python, Javascript, and several other programmers.

    Code:
    void fun() = null;
    You'll also find relatively few contexts where brace initialization occurs in C++11, and if you don't consider "in-place" contexts you can easily parse comma-delimited lists allowing a client to forgo the braces if they put everything on a single line.
    Might be difficult for e.g intializers for multidimensional arrays where the braces correspond to the structure of the initialized data.


    <Breaking long lines>
    A line beginning with a unique operator may be parsed no differently from a line ending with a unique operator.
    That's a good idea. I will have to think some more about it.

    Thanks for your comments.

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,439
    Quote Originally Posted by suncore View Post
    C++ as a base is good enough for me, but I wanted a few minor changes to the syntax.
    Syntax... frankly, the least useful aspect of your proposed language. More interesting to know is what is the impact of your changes on the compiler speed and generated code.
    Last edited by Mario F.; 03-02-2014 at 03:45 PM.
    whiteflags likes this.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,610
    Quote Originally Posted by phantomotap View Post
    [snip] programmers are doomed to repeat the mistakes of earlier languages. [snip]
    like OOP

    ^_^
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  8. #8
    Registered User
    Join Date
    Oct 2006
    Posts
    2,370
    I rather like curly brackets and semicolons. doing away with semicolons makes it more difficult to have multi-line statements, and curly brackets make scope more clear to the individual reading the code, even if they aren't entirely necessary for the compiler to understand it.
    Code:
    namespace life
    {
        const bool change = true;
    }

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21