Autor Beitrag
Mindforce
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: Sa 20.05.06 19:59 
Hi,

ich habe sehr viele Projekte vor mir... Nun möchte ich mich einer neuen Herrausforderung stellen.
Kann man selbst ein Compiler bauen?????

Falss ich eingebe: Dialog=Text(Hi) : Das er dann diesen Befehl zu : Showmessage('Hi') : Und dann viellicht noch ne EXE erstellen kann? 8) :lol:

Bitte mit´n bisssschen Source! :roll:

Gruss,

Mindforce
Spaceguide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 552


(D3/D7/D8) Prof.
BeitragVerfasst: Sa 20.05.06 20:28 
Erstmal das hier lesen:

de.wikipedia.org/wiki/Compilerbau
nullplan001
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 212

Win 2000 Professional, Debian Linux 4.0 (Etch,Stable)
Pascal (FreePascal 2.0.2, TurboPascal 7.0), C(++) (G++/GCC 3.4.2 + MinGW), Java (JDK 1.5.0_07), PHP (PHP 5.1.4)
BeitragVerfasst: Sa 20.05.06 20:36 
Also, ein Interpreter geht schonmal ziemlich schwer. Das wäre das erkennen von Quelltext und sofortiges Ausführen. Schwerer ist ein Compiler. Ein eigenständiger Compiler... ich glaub, das kannst du knicken. Aber kopf hoch: Du kannst dein Proggi den Quelltext in Assembler bauen lassen und dann einen frei verfügbaren Assembler drauf loslassen.
So, in Assembler stehen dir nur die API-Funktionen zur Verfügung. Glaub mir, WinAPI ist sehr anstrengend in Assembler. Ich spreche aus Erfahrung aus erster Hand.
ShowMessage gibt es nicht, es sei denn, du definierst eine solche Funktion. Was dann so aussieht:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
extrn LoadLibrary
extrn FreeLibrary
extrn GetProcAddress

.Data
MB_OK equ 0
MB_DefButton1 equ 0
Capt db "assembled prog",0
Mesg db "This program is assembled. Really! I promise.",0
DLL db "user32.dll",0 ; glaub ich zumindest
Func db"MessageBoxA",0 ; weis ich
hLib dd ?

.Code

proc showmessage
  xor eax,eax ; eax löschen
  mov ax,MB_OK
  or ax,MB_DefButton1
  push eax ; uType
  push offset Capt ; lpCaption
  push offset Mesg ; lpText
  push dword 0 ; hWnd
  jmp MessageBox ; call + ret
endp

proc MessageBox
  push offset DLL
  call LoadLibrary
  or eax,eax
  jz EndOfMB
  mov eax,hLib
  push offset Func
  push hLib
  call GetProcAddress
  or eax,eax
  jz FL
  call eax
  FL:
  push hLib
  call FreeLibrary
  EndOfMB:
  ret
endp

Na gut, das war jetzt dramatisiert, aber so in etwa wäre der Quelltext für ein simples showmessage. Ziemlich aufwändig, nicht war? Schuster, bleib bei deinen Leisten. Da gibt es genug andere, die sich den Kopf über sowas zerbrechen.
Tschö,
nullplan

_________________
Ich fahr' nicht selber, weil ich festgestellt habe: ich fahre zu emotional. Bin 180 gefahren wo 30 erlaubt war... -- Jürgen von der Lippe


Zuletzt bearbeitet von nullplan001 am So 21.05.06 10:17, insgesamt 2-mal bearbeitet
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: Sa 20.05.06 20:40 
Kann man sagen...
Ehhh. Dieser Quelltext... Was ist dat für ne Sprache??? C++????

Gruss,

Mindforce
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 20.05.06 20:48 
user profile iconMindforce hat folgendes geschrieben:
Kann man sagen...
Ehhh. Dieser Quelltext... Was ist dat für ne Sprache??? C++????

Gruss,

Mindforce


Er hat doch schon geschrieben das, das Assembler ist. C++-Code sieht ja ganz anders aus ;-)
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mo 22.05.06 09:31 
Und dann müsste man das noch compilieren.
Das sieht am Schluss so irgendwie aus (das ist jetzt nur eine com-Datei, die ein Paar Buchstaben auf der Konsole ausgibt...):

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
B4 0E B0 50 B7 00 CD 10-C3 F3 03 E8 04 F6 03 0B
05 F8 03 2B 05 F9 03 58-05 FA 03 85 34 00 71 0C
05 FD 03 A2 05 FE 03 B9-05 FF 03 E4 05 00 04 10
06 01 04 22 06 03 04 3A-06 05 04 5B 06 06 04 73
06 08 04 7E 06 09 04 97-06 0A 04 A9 06 0C 04 B8
06 0D 04 CE 06 0E 04 D9-06 0F 04 E9 06 10 04 2A
07 14 04 40 07 16 04 55-07 17 04 92 07 18 04 B3
07 19 04 C4 07 1A 04 D6-07 1B 04 F5 07 1C 04 04

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mo 22.05.06 10:12 
das ist eine aufgabe für die wirklichen pros unter den programmieren ;)
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: Mo 22.05.06 12:04 
Find ich auch... Naja... Mit 3 Jahren Zeit oder sogar 4... :roll:

Gruss,

Mindforce

_________________
Our force; in mind.
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mo 22.05.06 12:26 
Also der Aufwand ist wie schon mehrfach gesagt ENORM. Wegen irgendwelcher Dialoge,... würde ich AutoIT nehmen.
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mo 22.05.06 12:36 
er kann ja eine art eigene sprache machen, und den code dann in kA delphi code umwandeln, aber das darf dann net alzu sehr anders sein und ist schon schwer genug, ansonsten

Suche in Wikipedia BRAINFUCK

aber dann als einzige befehle write und writeln, kannst ja einen brainfuck 2 delphi und umgekehrt translator schreiben.


Zuletzt bearbeitet von F34r0fTh3D4rk am Mo 22.05.06 12:39, insgesamt 1-mal bearbeitet
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: Mo 22.05.06 12:38 
Gute Idde das mti GehirnsSchei***. BRAINFUCK
Werd ich mal ausprobieren.

Gruss,

Mindforce

_________________
Our force; in mind.
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mo 22.05.06 12:39 
Du meinst Hirnfick ;)