EvoX Genesis
EvoX Genesis는 고수준 목표를 재귀적 소프트웨어 세계로 전환해, 유한 에이전트가 개발하고 승인된 결과만 유지됩니다
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기C to Lisp to Forth compiler. Built as a third-year university project.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗
A C to Lisp to Forth compiler that runs in your browser
C to Forth is a two-stage compiler that turns C into Lisp and then Forth, running both in the browser and checking them against clisp, gforth and gcc
It was born as a third-year university project 🎓
flowchart TB
A["C Source"]:::nodeStyle1 --> B["Lexer"]:::nodeStyle2
B --> C["Parser"]:::nodeStyle2
C --> D["Lisp Emitter"]:::nodeStyle3
D --> E["Lisp Code"]:::nodeStyle4
E --> F["S-expression Reader"]:::nodeStyle3
F --> G["Forth Emitter"]:::nodeStyle3
G --> H["Forth Code"]:::nodeStyle4
E --> I["Lisp Interpreter"]:::nodeStyle5
H --> J["Forth Interpreter"]:::nodeStyle5
I --> K{"Same Output?"}:::decisionStyle
J --> K
classDef nodeStyle1 fill:#555555,color:#ffffff,stroke:#000000,stroke-width:2px,font-weight: bold;
classDef nodeStyle2 fill:#555555,color:#ffffff,stroke:#000000,stroke-width:2px,font-weight: bold;
classDef nodeStyle3 fill:#555555,color:#ffffff,stroke:#000000,stroke-width:2px,font-weight: bold;
classDef nodeStyle4 fill:#555555,color:#ffffff,stroke:#000000,stroke-width:2px,font-weight: bold;
classDef nodeStyle5 fill:#555555,color:#ffffff,stroke:#000000,stroke-width:2px,font-weight: bold;
classDef decisionStyle fill:#555555,color:#ffffff,stroke:#000000,stroke-width:2px,font-weight: bold;
c-to-forth/
├── .gitattributes # Git Attributes Configuration
├── .gitignore # Git Ignore Rules
├── biome.json # Lint & Format Configuration
├── index.html # Playground Page
├── LICENSE # Project License
├── package.json # Scripts & Dependencies
├── README.md # You are here! ⬅️
├── tsconfig.json # TypeScript Configuration
├── vite.config.ts # Build & Test Configuration
│
├── .github/workflows/
│ ├── ci.yml # Lint & Test Pipeline
│ └── pages.yml # GitHub Pages Deployment
│
├── assets/ # Visual Assets
│ ├── logo.svg # Project Logo
│ └── playground.png # Playground Screenshot
│
├── examples/ # Example C Programs
│
├── public/
│ └── favicon.svg # Playground Icon
│
├── src/
│ ├── compiler/
│ │ ├── lexer.ts # C Tokens
│ │ ├── parser.ts # C Syntax Tree
│ │ ├── lisp.ts # C to Lisp Translation
│ │ ├── sexpr.ts # S-expression Reader & Printer
│ │ ├── forth.ts # Lisp to Forth Translation
│ │ └── reserved.ts # Common Lisp & Gforth Names
│ │
│ ├── runtime/
│ │ ├── lisp.ts # Lisp Interpreter
│ │ └── forth.ts # Forth Interpreter
│ │
│ └── web/ # Playground Editor & Styles
│
└── tests/
├── expected/ # Verified Lisp, Forth & Outputs
├── fixtures/course/ # Original Course Test Programs
├── fixtures/lisp/ # Hand-Written Lisp Programs
├── fixtures/forth/ # Hand-Written Forth Programs
└── *.test.ts # Unit, Golden & Toolchain Tests
Clone the repository
git clone https://github.com/cristiangilsanz/c-to-forth.git
cd c-to-forth
Install the dependencies
npm install
npm run dev
npm test
npm run lint
sudo apt-get install clisp gforth gcc
dist/:npm run build
| C | Lisp | Forth |
|---|---|---|
int x = 5; | (setq x 5) | 5 value x |
int v[] = {1, 2, 3}; | (setq v (vector 1 2 3)) | create v 1 , 2 , 3 , |
x += v[i]; | (incf x (aref v i)) | x v i cells + @ + to x |
printf("%d\n", x); | (format t "~d~%" x) | x 0 .r cr |
if (a < b) ... else ... | (if (< a b) ... ...) | a b < if ... else ... then |
for (int i = 0; i < n; i++) | (dotimes (i n) ...) | n 0 max 0 ?do ... loop |
while (n > 0) ... | (loop while (> n 0) do ...) | begin n 0 > while ... repeat |
switch (d) { case 1: ... } | (case d (1 ...)) | d case 1 of ... endof endcase |
int f(int n) { ... } | (defun f (n) ...) | : f to f.n ... ; |
a / b and a % b | (truncate a b) and (rem a b) | a b quot and a b rem |
| Feature | Details |
|---|---|
| Types | int, char, short, long and bool as integers, arrays with initializers |
| Statements | if, else, while, do while, for, switch, break, continue and return |
| Operators | Arithmetic, comparisons, logic, bitwise, shifts, ?:, assignments, ++, -- and casts |
| Functions | Prototypes, recursion, mutual recursion and array parameters |
| Output | puts, putchar and printf with %d, %c, %s, %% and field widths |
| Extras | Hex, octal and character literals, # lines are skipped and //@ lines go into the Lisp |
| Stage | Details |
|---|---|
| Lisp Interpreter | Numbers, characters, strings, lists, vectors, closures, loop, format and special variables |
| Lisp to Forth | defun, let, cond, case, dotimes, loop with sum and count, block and vectors |
| Forth Interpreter | Colon definitions, do loops, case, defer, value, create, strings and number bases |
The following tips help you get the most out of C to Forth:
- Write a recursive function and see Forth save its locals.
- Edit the Lisp pane and watch the Forth follow.
- Share your code with Copy link.
This project was created together with Paola Herráez Bravo in our third year of university 🤝.
Thanks to the GNU CLISP and Gforth teams for the reference implementations every output is checked against ✨.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with 💖 for the Compiler Community