Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 03-16-2006, 01:50 AM   #11 (permalink)
 
Ultra Techie

Join Date: Sep 2005

Posts: 638

tommyboy123x is on a distinguished road

Send a message via AIM to tommyboy123x
Default

wow, you are honestly my hero... thinking about it, i would imagine it to be so complex but the way you described it made so much sense.

anyways... i owe a lot to you TheHeadFL... you have brought clarity to my world before vista succeeded in doing so

i guess i'll start by making a [not so] simple compiler and go from there... again, thank you, that was a great post. If you have any other info that might be helpful i would be very happy to hear, but as of now this thread is pretty closed....
__________________

Some real (as in actual) surveys that pay money!
tommyboy123x is offline  
Old 03-16-2006, 12:07 PM   #12 (permalink)
 
Ultra Techie

Join Date: Jul 2005

Posts: 530

TheHeadFL

Send a message via AIM to TheHeadFL
Default

In a class I took at my university one time we built a two pass assembler, which is a very simple form of a compiler.

You could make an assembler and in this way you would learn how x86 assembly instructions are mapped to binary.

In other words, you would read up on the x86 instruction set (there are undoubtedly many papers on the subject from Intel/AMD) and then you could do the translations I described above. Just as a practice exercise.

I am not personally familiar with the x86 instruction set because it is much more complicated than the processor I was working with in my architecture courses. We used the MIPS R3000 processor which is quite different from the x86. The MIPS R3000 has a 5 stage pipeline (as I recall) whereas some x86 processors have pipelines with 20-30 stages or more. (i.e. Pentium 4) As a result, x86 assembly tends to be a lot more complicated than MIPS assembly, because the underlying processor is much more complex.

Anyway, the only other detail that I myself profess ignorance about is how to produce the loading code. You see, in addition to the binary that I mentioned generating above, a compiler also generates certain other 'semantic' information that an operating system reads to determine the 'entry point' to the code. (In other words, where to begin execution) Once this is determined, a portion of the executable code runs that is generated by the compiler. This loads the instruction data and other data into memory before actual program execution begins. You'd have to read up on the specifics of the loader mechanism for a Windows program.
__________________
Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache)
TheHeadFL is offline  
Old 03-18-2006, 10:10 PM   #13 (permalink)
 
Ultra Techie

Join Date: Sep 2005

Posts: 638

tommyboy123x is on a distinguished road

Send a message via AIM to tommyboy123x
Default

so as a quick summary of the thread, a programming language is really the compiler. If you write something like "i ate fish today" in notepad or w/e, you could make a compiler interpret that and send it to the cpu as "open [iexplore.exe] internet explorer" or some other function like this, correct?
__________________

Some real (as in actual) surveys that pay money!
tommyboy123x is offline  
Old 03-19-2006, 12:50 AM   #14 (permalink)
 
Ultra Techie

Join Date: Jul 2005

Posts: 530

TheHeadFL

Send a message via AIM to TheHeadFL
Default

Pretty much. Although I wouldn't consider that a true 'programming language'. I would consider that more of a scripting language or a macro language.

A programming language at its most basic should allow the programmer some way to execute the basic operations.... Load, Store, Branch (If/Else), Jumps, and Arithmetic.

Generally also they will have what is called a 'Formal Grammar'.

Most compiler language parsers use a formal grammar specification to check syntax.

For instance, you can say a programming language might follow this grammar:

(I'm enclosing grammar 'objects' in parenthesis. := means 'is')
Code:
(statement) := (function)(;) or (expression)(;)
(function) := (identifier)( ( )( ) )
(expression) := (identifier) (=) (expression) or (identifier) (mathop) (identifier)
(identifier) := (variable) or (number) or (procedure_call)
(mathop) := (+) or (-) or (*) or (/) or (^) or (%)
And so on and so forth.
__________________
Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache)
TheHeadFL is offline  
Old 03-19-2006, 02:18 AM   #15 (permalink)
 
Ultra Techie

Join Date: Sep 2005

Posts: 638

tommyboy123x is on a distinguished road

Send a message via AIM to tommyboy123x
Default

ok, i understand. Just to let other possible readers know, i picked up some books on making compilers as well. They were within the link that csamuels sent

Operating Systems - Design and Implimentation - For understanding of the operating system and such

Optimizing Compilers for Modern Architechtures - For optimization...

Advanced Compiler Design and Implimentation - duh

i wouldn't suggest buying these books new, for they are a good 100 bucks each, much like a text book (which they are). Instead search for online "college book trade-in" stores, or something like this store. Just as good (maybe slightly damaged), but MUCH cheaper. I ended up spending about 50 bucks on all three!!!!!!

Thanks again for all the help
__________________

Some real (as in actual) surveys that pay money!
tommyboy123x is offline  
Old 03-19-2006, 10:01 AM   #16 (permalink)
 
Super Techie

Join Date: Oct 2005

Posts: 385

raross

Default

Also, if you go to an ABET accreddited computer science program, you will have to make your own language. It is actually quite fun and pretty simple.
__________________
MCSD, MCAD, CCNA, CIW-A, Linux+, Server+, Security+, Project+, iNet+, Network+, A+, MCP
raross is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On