Thread: Introduce my programming language & compiler

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    6

    Introduce my programming language & compiler

    Hi All,

    I've made a C-like programming language and related compiler.
    It offers an alternative programming experiences.

    Details could be found in my forum:
    http://mycompiler.forumer.com

    Best Regards
    blackoil

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Having read this page that refers to the language's syntax, I noticed that:
    (*) You introduce the unnecessary boolean XOR as "^^", while ignoring the fundamental boolean NOT "!"
    (*) You deliberately ignore the Structure dereference operator "->"
    (*) You haven't added an important operator, the Ternary conditional "?:"
    (*) What about using the comma as an operator?

    Keep it up though, it's pretty good.
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Jun 2012
    Posts
    6
    && || ^^ are all operators in my design, the compiler will generate codes for them. and I forget to mention the "NOT" operator in the document. Comma is an operator too.

    Structure is treated as new type. So there's no dereference operator "->". use this sort of expression to access structural member.
    (*mystructure).member //mystructure is a pointer to new type

    For Ternary operator "?:", I am still thinking how to implement it well.

    Quote Originally Posted by GReaper View Post
    Having read this page that refers to the language's syntax, I noticed that:
    (*) You introduce the unnecessary boolean XOR as "^^", while ignoring the fundamental boolean NOT "!"
    (*) You deliberately ignore the Structure dereference operator "->"
    (*) You haven't added an important operator, the Ternary conditional "?:"
    (*) What about using the comma as an operator?

    Keep it up though, it's pretty good.

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Quote Originally Posted by blackoil View Post
    For Ternary operator "?:", I am still thinking how to implement it well.
    Oh, that's pretty straightforward. All you need to do is "convert":
    Code:
    conditions ? expression1 : expression2;
    to
    Code:
    if (conditions)
        expression1;
    else
        expression2;
    Devoted my life to programming...

  5. #5
    Registered User
    Join Date
    Jun 2012
    Posts
    6
    Yes I know it's pretty straightforward. As the "?" sign is used to replace "...". And ternery operation isn't used frequently.
    For boolean NOT, use

    if (condition == 0) statementlist;

    I totally forget to implement it.

  6. #6
    Registered User
    Join Date
    Jun 2012
    Posts
    6
    added logical NOT operator

    Code:
    int a;
    void main()
    {
     if(!(a==1))
      a=100;
    }
    Code:
    global  _main
    _main:
    push    ebp
    push    ebx
    push    esi
    push    edi
    mov     ebp, esp
    cmp     [ _a ], dword 0x1
    sete    al
    xor     al, 0x1
    jz      .L0
    mov     [ _a ], dword 0x64
    .L0:
    mov     esp, ebp
    pop     edi
    pop     esi
    pop     ebx
    pop     ebp
    ret
    section .data align=4
    global  _a
    _a:     dd      0x0

  7. #7
    Registered User
    Join Date
    Jun 2012
    Posts
    6
    added rotation operator

    <<< left rotation
    >>> right rotation
    <<<. left rotation with carry
    >>>. right rotation with carry

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    You don't need NOT if you have XOR... NOT(x) = x XOR (11111...)
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  9. #9
    Registered User
    Join Date
    Jun 2012
    Posts
    6
    The compiler do a raw compilation. In fact, if(!(a==1)) => if((a!=1))

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's the Difference Between a Programming Language and a Scripting Language?
    By Krak in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 07-15-2005, 04:46 PM
  2. Introduce Myself
    By Apathy in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 12-10-2004, 02:40 PM
  3. which programming language should be used for socket programming?
    By albert_wong_bmw in forum Networking/Device Communication
    Replies: 8
    Last Post: 06-04-2004, 08:12 PM
  4. That other programming language
    By volk in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 05-14-2003, 05:42 PM
  5. ...just thought I would introduce my self...
    By GGrrl in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-24-2003, 11:03 AM

Tags for this Thread