Artificial Intelligence Programming Lab(AIPLab) 討論區

Please login or register.

請輸入帳號, 密碼以及預計登入時間

新聞:

[開學]106學年第1學期的課程看版開張了 歡迎同學問問題-20170917

作者 主題: [期末報告]-第二類Special Compiler 95441116  (閱讀 30439 次)

95441116

  • Newbie
  • *
  • 文章: 1
    • 檢視個人資料
[期末報告]-第二類Special Compiler 95441116
« 於: 一月 07, 2009, 08:11:25 am »
CSIE 3B  95441116 湯鎮遠

Sec. Special Compiler

Cross Compiler
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is run. Cross compiler tools are generally found in use to generate compiles for embedded system or multiple platforms. It is a tool that one must use for a platform where it is inconvenient or impossible to compile on that platform, like microcontrollers that run with a minimal amount of memory for their own purpose. It has become more common to use this tool for paravirtualization where a system may have one or more platforms in use.

Not targeted by this definition are source to source translators, which are often called by the name of cross compiler.

Uses of cross compilers
The fundamental use of a cross compiler is to separate the build environment from the target environment. This is useful in a number of situations:

Embedded computers where a device has extremely limited resources. For example, a microwave oven will have an extremely small computer to read its touchpad and door sensor, provide output to a digital display and speaker, and to control the machinery for cooking food. This computer will not be powerful enough to run a compiler, a file system, or a development environment. Since debugging and testing may also require more resources than is available on an embedded system, cross-compilation can be less involved and less prone to errors than native compilation.
Compiling for multiple machines. For example, a company may wish to support several different versions of an operating system or to support several different operating systems. By using a cross compiler, a single build environment can be set up to compile for each of these targets.
Compiling on a server farm. Similar to compiling for multiple machines, a complicated build that involves many compile operations can be executed across any machine that is free regardless of its brand or current version of an operating system.
Bootstrapping to a new platform. When developing software for a new platform, or the emulator of a future platform, one uses a cross compiler to compile necessary tools such as the operating system and a native compiler.
Compiling native code for emulators for older now-obsolete platforms like the Commdore 64 or Apple II by enthusiasts who use cross compilers that run on a current platform (such as Aztec C's MS DOS 6502 cross compilers running under Windows XP).
Use of virtual machines (such as Java's JVM) resolves some of the reasons for which cross compilers were developed. The virtual machine paradigm allows the same compiler output to be used across multiple target systems.

Typically the hardware architecture differs (e.g. compiling a program destined for the MIPS architecture on an x86 computer) but cross-compilation is also applicable when only the operating system environment differs, as when compiling a FreeBSD program under Linux, or even just the system library, as when compiling programs with uClibc on a glibc host.

http://en.wikipedia.org/wiki/Cross_compiler
 
About Python
Python的創始人為Guido van Rossum。在1989年聖誕節期間的阿姆斯特丹,Guido為了打發聖誕節的無趣,決心開發一個新的指令碼解釋程式,作為ABC語言的一種繼承。之所以選中 Python(大蟒蛇的意思)作為程式的名字,是因為他是一個Monty Python的飛行馬戲團的愛好者。

ABC是由Guido參加設計的一種教學語言。就Guido本人看來,ABC這種語言非常優美和強大,是專門為非專業程式設計師設計的。但是ABC語言並沒有成功,究其原因,Guido 認為是非開放造成的。Guido 決心在 Python 中避免這一錯誤(的確如此,Python 與其它的語言如C、C++和Java結合的非常好)。同時,他還想實作在 ABC 中閃現過但未曾實作的東西。

就這樣,Python在Guido手中誕生了。實際上,第一個實作是在Mac機上。可以說,Python是從ABC發展起來,主要受到了Modula-3(另一種相當優美且強大的語言,為小型團體所設計的)的影響。並且結合了Unix shell和C的習慣。

Python的另外一個特點就是可以將程式切成小模組,然後這些模組還可以應用在其他的程式之中。Python本身也有一個相當大的標準模組庫可以讓你來使用,或者當作學習Python程式設計的範例。在Python中也有內建的模組可以提供許多功能,諸如:檔案I/O、系統呼叫、sockets,甚至是與Tk之類的GUI工具互動的介面。

Python是一個直譯式的語言,可以省掉你在開發程式時不少編譯及連結程式的時間。這個Python的直譯器甚至可以互動式的使用,讓你在寫一些小程式來試驗Python語言的特性,或是測試程式時可以寫節省不少時間。你還可以用Python直譯器來當作計算機呢。

Python讓你可以寫出非常精練及可讀性高的程式。用Python寫出的程式通常比用C或C++寫的程式要短得多,其理由如下:

因為其高階的資料型態,使得你可以用很簡單的敘述(statement)就能夠表達複雜的運作過程
Python使用縮排來代替C/C++中常見的前後括號{}
Python不需要變數或是參數的宣告
Python 是延伸性高的語言。如果你知道如何寫C語言的程式的話,你很容易就可以在Python的直譯器中加入新的內建函數(function)或是模組,這樣做的好處是你可以讓程式中關鍵的部分速度調到最快,或者是連結Python到binary的程式庫(例如是廠商做好的圖形程式庫)去。一但你真的需要,你也可以把Python直譯器加入到你用C寫的應用程式裡面去,然後Python就變成你的應用程式的延伸或是商業化的語言了。

除了數字之外, Python也有能力處理字串(string)。字串在Python中有很多種表達方式,它可以放在雙括號””之中,也可以放在單括號’’裡面:


>>> 'spam eggs''spam eggs'>>> 'doesn\'t'


http://www.freebsd.org.hk/html/python
« 最後編輯時間: 一月 11, 2009, 11:22:45 am 由 95441116 »
已記錄

admin

  • 管理員
  • Hero Member
  • *****
  • 文章: 1897
    • 檢視個人資料
回覆: [期末報告]-第二類Special Compiler 95441116
« 回覆文章 #1 於: 一月 15, 2009, 02:20:44 pm »
不符合報告要求, 8
已記錄
 

SimplePortal Classic 2.0.5