xcessive
Epic Poster
.[M:5000]
Posts: 526
|
xBasic
Apr 24, 2011 10:42:37 GMT
Post by xcessive on Apr 24, 2011 10:42:37 GMT
If you want too take a look at my source code, you are welcome too. You too jordan, but I daresay you would code it exactly the same way
|
|
Nick
VIP
v5 Beta Tester[M:5000]
Philadelphia Eagles: 8-8
Posts: 2,239
|
Post by Nick on Apr 24, 2011 16:46:28 GMT
If you want too take a look at my source code, you are welcome too. You too jordan, but I daresay you would code it exactly the same way That would be cool. Do you put it under program files? Like java?
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
xBasic
Apr 25, 2011 0:13:08 GMT
Post by xcessive on Apr 25, 2011 0:13:08 GMT
lolwat? Its in blitzmax, its a compiled language, you just feed it the source code so no its just text.
|
|
Nick
VIP
v5 Beta Tester[M:5000]
Philadelphia Eagles: 8-8
Posts: 2,239
|
Post by Nick on Apr 25, 2011 4:45:04 GMT
Haha, please excuse my stupidity in this subject.
|
|
Jordan
Elite Poster
[M:5000]
Posts: 286
|
xBasic
Apr 26, 2011 2:20:45 GMT
Post by Jordan on Apr 26, 2011 2:20:45 GMT
Nick, I suggest you learn a programming language first, and I mean really learn the language. Php does not count as a programming language by the way. Also, learn about data structures such as stacks, heaps, binary search trees, queue's etc. Get a good foundation of knowledge before attempting a project such as this. $0.02 Yeah, I've actually been working on Java for 2-3 weeks now because as you said, PHP isn't really an actual program language And I've also been reading up on the workings of computers. Circuitry and stuff. I don't know if you have played the game Minecraft, but it allows you to set up circuits and I've build some simple binary calculators. I recently built a 4 bit calculator that could add and subtract. And I will probably not attempt this project, in the near future at least I'm just very curious and like to know/figure out how things work. Thanks for the advice, and the two cents! Even though USD is way down, so I'd be lucky to have a penny. Java is a good language for beginners so keep at it. I've seen some friends play minecraft, but I haven't played it myself. That's pretty cool that you made a calculator with it, though. Knowing those low level features can really help, and I know it certainly helps me, especially when I work with C/C++. If you're interested in that type of stuff, read up on things like bitmasks, bitwise operators, and bit shifting. And you're welcome. ;P If you want too take a look at my source code, you are welcome too. You too jordan, but I daresay you would code it exactly the same way Hah, I'll have to check it out once this dreadful semester is over. Haha, please excuse my stupidity in this subject. I was a little confused about the same thing around your age (assuming your age is correct at 16). Just to clear things up for you, here's what happens when you write code. You press "compile" or "build", and a program called the compiler reads your code, and turns it into another form of code depending on what language you are using. If you are writing C/C++, it will turn it straight into assembly commands which all have binary values that the processor(s) on your computer can execute directly (mov, jmp, add, sub etc). They are very simple and are not high level at all (there are no "if statements" or "loops", you have to use basic logic to implement those high level statements). It's about as low level as you can get, and it takes forever to write anything which is why programming languages were invented. Java is a little different because it gets compiled down to "byte code" which is platform independent (meaning the same code works for Windows, Mac, Linux etc). However, this byte code cannot be executed by the processor, but must be executed by a program which they call the Java Virtual Machine (which is a program that is compiled to native code that the processor can execute). This is one of the reasons why Java is a little slower than C++, and that's because Java's code isn't compiled straight down to native machine language which can be executed directly by the processor. C# is the same way from my understanding, but they don't call it byte code. Scripting languages like Javascript, Python, and php are never compiled but are "interpreted" by another program at runtime so they are a lot slower. This is what xcessive is doing, he's writing a program which reads text and then executes certain commands based on what the text says with a compiled program. In summary, compiling to machine code is the fastest because the processor can execute the code directly. Programs compiled to byte code are a little slower because they have to be executed by another program (the virtual machine). A big plus for compiled languages is that the compiler can optimize a lot of the code so the program doesn't have to do as much work during runtime. Interpreted languages are much slower since they have to be interpreted by another program which is compiled to native code. Sorry if this isn't too clear, I can't write clearly today.
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
xBasic
Sept 3, 2011 6:19:56 GMT
Post by xcessive on Sept 3, 2011 6:19:56 GMT
Progress has begun again on this project. It has taken a new direction using the GNU GCC compiler as a backend. Anyways right now theres only a very simple command set. Feel free to have a look, heres a demo that runs on Windows: www.2shared.com/file/t3T9SY5Q/Compiler.htmlDown the bottom right hand corner - "Save file to your PC: Download" Basically you write your source code in source.txt, run the compiletest.exe and it will create an executable called "testicals.exe" (lol).
|
|
prads
Elite Poster
[M:0]
It's a shame that PI isn't an integer :(
Posts: 361
|
xBasic
Sept 3, 2011 9:03:00 GMT
Post by prads on Sept 3, 2011 9:03:00 GMT
I'm referring to one high level language getting translated into another high level language to be compiled. Java gets compiled to byte code (similar to C#) which is executed in a virtual machine, it's not translated into a form of code you'd normally write yourself. Php is interpreted by C/C++ if I remember correctly, and I know C is translated into assembly (like C++) which can be directly translated into binary since all the assembly commands reprecent binary commands that the processor can execute. I took a whole class on assembly and I'm glad it's over. ;P I was thinking of implementing that myself once, I would create assembly instruction set and when the source is compiled it translates into that instruction set, just like java byte code. Then I would create a virtual machine of some sort to run the program. Maybe use recompilation techniques to make it run faster. I didn't start the project because I was busy and maybe after I finish my current project and then start learning dynamic recompilation techniques, I may give it a try. And glad to see xcessive making progress in this project. I haven't checked it out yet but I will soon.
|
|
prads
Elite Poster
[M:0]
It's a shame that PI isn't an integer :(
Posts: 361
|
xBasic
Sept 4, 2011 5:15:22 GMT
Post by prads on Sept 4, 2011 5:15:22 GMT
So, you are translating the source code to Cpp source and then using GCC compiler to compile the Cpp source?
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
xBasic
Sept 4, 2011 8:35:17 GMT
Post by xcessive on Sept 4, 2011 8:35:17 GMT
So, you are translating the source code to Cpp source and then using GCC compiler to compile the Cpp source? Thats what I said. Think about it, its actually a cool idea for now. I can implement the command set I want now and not have to worry about OS/Processor architecture. It also means I don't have to worry about optimizing the compiler. Anyway my goal was never to make a compiler, it was to make a language for extremely easy game development. This way I can do that and have an extremely efficient compiled language, and use GLUT for the graphics into the bargain.
|
|
prads
Elite Poster
[M:0]
It's a shame that PI isn't an integer :(
Posts: 361
|
xBasic
Sept 4, 2011 11:46:56 GMT
Post by prads on Sept 4, 2011 11:46:56 GMT
Not a bad idea at all. So, the trick now is to produce efficient C++ source and at the same time make the language much more simple than C++. I would like to see the source code it generates but it seems it deletes it right after the compiler compiles the code.
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
xBasic
Sept 4, 2011 12:56:33 GMT
Post by xcessive on Sept 4, 2011 12:56:33 GMT
Not a bad idea at all. So, the trick now is to produce efficient C++ source and at the same time make the language much more simple than C++. I would like to see the source code it generates but it seems it deletes it right after the compiler compiles the code. Yeh, well I was planning to have a "Show source" option. Its easy enough to turn it off for you. Yeh I agree, the issue now is clean efficient cpp, and memory management!
|
|
prads
Elite Poster
[M:0]
It's a shame that PI isn't an integer :(
Posts: 361
|
xBasic
Sept 4, 2011 16:03:32 GMT
Post by prads on Sept 4, 2011 16:03:32 GMT
I patched the exe so it doesn't delete the source code file anymore. Attached it if you want it. LOL I will look at some source code it translates and let you know what I think... Attachments:
|
|
prads
Elite Poster
[M:0]
It's a shame that PI isn't an integer :(
Posts: 361
|
xBasic
Sept 5, 2011 10:40:33 GMT
Post by prads on Sept 5, 2011 10:40:33 GMT
It seems to put headers stdio.h and time.h unnecessarily in every source. It would be good idea to put header only if the source uses them. Also the sample source code generates two getchar(), one gets generated automatically and other because of waitkey() function. Also small things like "while(something)" don't work and it has to be "while (something)", tab key don't work etc are really annoying. And nice string support. int x[5]={97, 98, 99, 100, 101} print (char)x[0] print (char)x[1] print (char)x[2] print (char)x[3] print (char)x[4]
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
xBasic
Sept 5, 2011 11:49:20 GMT
Post by xcessive on Sept 5, 2011 11:49:20 GMT
time.h is used for my own profiling. getchar() is inserted twice again for my own profiling + my oversight with waitkey.
Everything else you mentioned I have already worked on and fixed. Its just a matter of keeping track of function calls and stripping white space. All trivial stuff that I didn't implement in my first mad rush of inspiration.
For the next update thats all fixed, but the main feature will be a simple 2D graphics command set based on Glut (for portability). I am planning to base it on sprites to make it super easy for beginners. Or perhaps a simple double buffered clear->draw stuff->flip buffer pipeline.
|
|
Jordan
Elite Poster
[M:5000]
Posts: 286
|
xBasic
Sept 5, 2011 19:09:30 GMT
Post by Jordan on Sept 5, 2011 19:09:30 GMT
This is really cool, is all your source code in the download you posted above?
|
|
prads
Elite Poster
[M:0]
It's a shame that PI isn't an integer :(
Posts: 361
|
xBasic
Sept 6, 2011 2:18:10 GMT
Post by prads on Sept 6, 2011 2:18:10 GMT
This is really cool, is all your source code in the download you posted above? I don't think there were any source codes. The download he posted above doesn't do much. I would wait until he posts new version that has graphics ability.
|
|
Jordan
Elite Poster
[M:5000]
Posts: 286
|
xBasic
Sept 6, 2011 2:44:19 GMT
Post by Jordan on Sept 6, 2011 2:44:19 GMT
Ah, okay. I was just hoping I could play with it and even add some features cause this is a great idea.
|
|