{"id":13783025,"url":"https://github.com/stdio2016/OOPS","last_synced_at":"2025-05-11T17:30:39.486Z","repository":{"id":134083651,"uuid":"51812621","full_name":"stdio2016/OOPS","owner":"stdio2016","description":"OOPS! 這個語言好難。這才是純物件導向語言","archived":false,"fork":false,"pushed_at":"2019-04-27T12:18:06.000Z","size":99,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T18:18:08.352Z","etag":null,"topics":["esolang","interpreter","object-oriented-programming"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stdio2016.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-02-16T06:13:41.000Z","updated_at":"2022-11-08T22:04:59.000Z","dependencies_parsed_at":"2024-01-07T23:09:31.137Z","dependency_job_id":"1cc81c0b-854b-498b-9674-d091e728c879","html_url":"https://github.com/stdio2016/OOPS","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdio2016%2FOOPS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdio2016%2FOOPS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdio2016%2FOOPS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stdio2016%2FOOPS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stdio2016","download_url":"https://codeload.github.com/stdio2016/OOPS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253604394,"owners_count":21934854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esolang","interpreter","object-oriented-programming"],"created_at":"2024-08-03T18:01:51.315Z","updated_at":"2025-05-11T17:30:39.140Z","avatar_url":"https://github.com/stdio2016.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# OOPS\nOOPS! 這個語言好難。但這才是純物件導向語言\n\nOOPS 是 Object Orient Programming System 的簡稱，裡面只有跟物件導向相關的指令，以及必要的標準輸入輸出指令\n\n這裡提供一個 OOPS 語言的直譯器，讓你實際使用 OOPS\n\n## 版本紀錄\n* 2018/7/17：直譯器寫出來了\n* 2018/7/21：加入垃圾收集機制\n* 2018/7/22：加入堆疊檢查\n\n## 特色\nOOPS 語言中只有一種資料型態，就是物件。OOPS 實現了物件導向的封裝、繼承、多型等特性\n\n### 物件與類別\nOOPS 屬於類別導向 (class-based)，所以在 OOPS 裡，要產生物件 (object)，你必須要先宣告類別 (class)\n\n類別可以想像成是設計圖，物件則可以想像成是成品。類別敘述物件可以做的事情，按照物件導向設計的用語，這稱為方法 (method)\n\n### 訊息傳遞\n為了讓物件能夠真的做到想要的功能，可以要求物件執行方法，稱作呼叫 (call)。OOPS 的呼叫語法是 `obj.methodName(args)`，其中 obj 是指定的物件，methodName 是方法的名稱，args 是參數\n\n在 OOPS 裡，所有的方法都是公有 (public) 的，這表示，任何的程式都能呼叫這些方法\n\n### 封裝\n在 OOPS 裡，每個物件有自己的變數，稱為成員變數 (member variable)，而且只有自己才能更改這些變數，因為它們都是私有 (*private*) 成員變數\n\n### 繼承\nOOPS 的類別 (class) 是可以繼承的。只要使用繼承，子類別 (subclass) 就可以使用父類別 (parent class) 的方法和成員變數。\n\n如果需要，子類別也可以覆寫父類別的方法，因為所有的方法都是虛擬 (virtual) 的\n\n### 多型\nOOPS 支援多型，而且這大概是最常用到的物件導向特性，因為，啊～OOPS 沒有迴圈，也沒有判斷式語法 (我認為有了這些功能就不是純物件導向了)\n\n## 編譯方法\n請先安裝 bison 和 flex，一定要 bison ，因為我用了 bison 才有的功能 `%destructor`，還有一定要 flex，因為 lex 年代太久遠，有很多功能都不支援\n\n進入 `src` 資料夾，然後在命令列下輸入 `make`\n\n然後就會在資料夾裡面出現 `oops` 程式了！耶！\n\n要在 Windows 底下編譯這個程式，需要先安裝 Cygwin，可以只安裝裡面的 flex、bison 和 gcc。\n編譯輸入的指令要改成 `make CFLAGS=\"-L C:\\cygwin64\\lib\"`，如果你安裝 Cygwin 的位置是 `C:\\cygwin64`。\n還有，要記得把 Cygwin 加進 PATH 環境變數\n\n## 執行方法\n用法： `./oops \u003csource file\u003e`\n\n在 Windows 的命令列裡，請改成 `.\\oops \u003csource file\u003e`\n\n執行 OOPS 程式碼\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstdio2016%2FOOPS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstdio2016%2FOOPS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstdio2016%2FOOPS/lists"}