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
Printable View
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
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. :)
&& || ^^ 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.
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.
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
added rotation operator
<<< left rotation
>>> right rotation
<<<. left rotation with carry
>>>. right rotation with carry
You don't need NOT if you have XOR... NOT(x) = x XOR (11111...)
The compiler do a raw compilation. In fact, if(!(a==1)) => if((a!=1))