Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Fr 23.03.07 19:32 
Also....

nachdem user profile iconBackslash so eine tolle Brainfuck-Signatur hat, wollte ich mal wissen, was da drin steht, und hab mir einen kleine BF-Interpreter gebastelt.

Ist alles etwas Quick'n'Dirty, einen Preis für das kleinste Programm würde ich auch nicht gewinnen... aber egal. Zum Angucken sicherlich ganz brauchbar.
EDIT: mittlerweile ist es mehr als das...


Ein paar Programme:

"Hello World"
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<
+++++++++++++++.>.+++.------.--------.>+.>.

Backslash's Signatur

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>----.>---.++.++++++++.++++++++.-------. -----------.++++++++++++++++++.-----------.

BenBE:
++++[>++++<-]>[>++++>++++++>+++++++>++++>++++>+++<<<<<<-]>++.>+++++.>--.>++.>+++++.>--...


EDIT 2013-08-29:
Das SVN von damals existiert mittlerweile nicht mehr, der letzte Stand existiert jetzt in Form eines Git-Repos hier:
github.com/martok/brainfuck
Einloggen, um Attachments anzusehen!
_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."


Zuletzt bearbeitet von Martok am Do 29.08.13 18:12, insgesamt 7-mal bearbeitet

Für diesen Beitrag haben gedankt: Mathematiker
konbom
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 36

Win XP Home
Delphi 2005 Personal
BeitragVerfasst: Sa 24.03.07 12:59 
user profile iconMartok hat folgendes geschrieben:

Bei Backslash fehlt allerdings am Ende das 'h'. Keine Ahnung, ob das an mir oder der Sig liegt....

Ich glaub, das liegt an dir ;). Es werden nämlich zumindest 9 Zeichen ausgegeben (9 mal '.').
Tolle Programm-Idee! Hat mich erstmal dazu gebracht auch son Ding zu schreiben (Bei mir ist Backslash übrigens vollständig ;) ). Irgendwie finde ich Brainfuck cool :).

MfG
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 24.03.07 13:39 
EDIT: jetzt gehts auch..... sehr seltsam...

Das Interessante ist ja, dass es so gut wie keine Hochsprachen-BF-Interpreter gibt (zumindest hab ich keine gefunden). In Assembler ist sowas ja relativ einfach...

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Backslash
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 202

WIN XP
Delphi 5 Ent, Delphi 2005 Prof
BeitragVerfasst: Mo 26.03.07 01:03 
Ich such gerade nach meinem Namen im Forum und was sehe ich da? Ich bin ein Trendsetter :lol: Hab ich wohl mal wieder nen Trend creiert? *LOOL* :rofl: Das ist übrigens mein erstes Brainfuck programm in meiner Signatur. Im wesentlichen hab ich von Hello World kopiert. Also über wikipedia findest du unter "brainfuck" einen coolen Freeware-Compiler.

Gruß

Backslash

PS: Ich hab irgendwann in der Ausbildung von Brainfuck gehört und wusste eigentlich nie so genau wie der Code aussieht. Erst die Signatur anderer Member die mit "Geek" geschrieben wurde, hat mich neugierig gemacht.

Meine Signatur bedeutet compiliert "Backslash"
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Sa 07.04.07 15:00 
irgendwie bekomme ich es net hin, text ins fenster reinzukopieren ^^ strg+v versagt ;)
ich wusste garnet, dass der bf interpreter so unkompliziert ist ;) (hab grad mal spasseshalber irgendwas eingegeben und es wurde ne note angezeigt und ein ton ausgegeben ;) )

kA wie ich das gemacht habe :P

mfg
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 07.04.07 17:11 
Folgendes Programm crasht deinen Interpreter:
ausblenden Quelltext
1:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.].					

Im besten Fall würde er die schließende Klammer ignorieren, im Worst-Case ne Syntax-Fehlermeldung ausgeben.

Ach ja: Weiter Bugs:
In der While-Schleife muss es prg<=Length(Program) heißen.

Weiterer Testcase:
ausblenden Quelltext
1:
++++[>++++<-]>[>++++>++++++>+++++++>++++>++++>+++<<<<<<-]>++.>+++++.>--.>++.>+++++.>--...					


@user profile iconChristian S.: Wie sieht das eigentlich mit einem Highlighter für Brainfuck aus? :mrgreen:

Nächster Bug: Die Zeicheneingabe funktioniert nur bedingt??? Oder ist das Absicht, dass man nicht das Zeichen sondern die Zeichennummer eingeben soll???

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 07.04.07 17:42 
user profile iconBenBE hat folgendes geschrieben:
Folgendes Programm crasht deinen Interpreter:
ausblenden Quelltext
1:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.].					

Im besten Fall würde er die schließende Klammer ignorieren, im Worst-Case ne Syntax-Fehlermeldung ausgeben.

Behoben (ignoriert Rücksprünge ohne gepushte Adresse.)
user profile iconBenBE hat folgendes geschrieben:
Ach ja: Weiter Bugs:
In der While-Schleife muss es prg<=Length(Program) heißen.

Ditto.

user profile iconBenBE hat folgendes geschrieben:
Nächster Bug: Die Zeicheneingabe funktioniert nur bedingt??? Oder ist das Absicht, dass man nicht das Zeichen sondern die Zeichennummer eingeben soll???

Na klar! Damit foltere ich die User :twisted:

Nee, mal im ernst: behoben.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Sa 07.04.07 18:22 
Wenn du jetzt aus dem Interpreter noch nen Compiler machst, wär's perfekt ;)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 07.04.07 19:04 
Nächster Bug:

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:
45:
46:
47:
,>,
[<+>-]<
>>>>>>+++++
[
 <<<<+++
 [
  <+++>-
 ]
 <+<
 >>[-]
 >[-]
 >[-]
 >[-]
 <<<<<
 [
  ->->+>>
  [-]+<<<
  [
   >>>>+<<<<-
  ]
  [
   >>>-<<<[-]
  ]
  >>>>
  [
   <<<<->>>>+
  ]>>>
  [
   <<
   [
    -<+>
   ]
   >+>
  ]
  <<<<
 ]
 [-]>
 [-]++++
 [-<++++>]<
 [->+++<]>>
 [<+>-]<.
 [-]<
 [-]>>
 [-]>
 [<<<+>>>-]
 >>>
]


Hängt sich aus unerfindlichen Gründen bei der Zahleneingabe auf. (Benötigt Version mit ReadLn für Zahlen).

Add: Vielleicht , für Zeichen und # für Zahlen???

//Edit: Source etwas formatiert.
//Anmerkung: Soll wenn's mal funzt n Programm werden, was zwei Zahlen einliest und addiert und das Ergebnis ausgibt.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 08.04.07 14:31 
So, neue Version ist oben.

Neu ist eine IDE mit Step by Step-Debugger.
Das Script aus Bens letztem Post läuft immer noch nicht ganz, aber es ist kein Interpreter-Fehler mehr drin ;)

Außerdem haben wir jetzt wirklich # zur direkten Zahleneingabe und , für ASCII-Zeichen.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 08.04.07 17:18 
hi, zur ide hab ich noch einige vorschläge:

  • Beim Schrittweisen debuggen, sollten Zeichen, die net BF Zeichen sind (also kommentare) einfach übersprungen werden, das wäre extrem praktisch.
  • Breakpoints (zumindest einer) wäre(n) cool, dann kann man sehen, an welcher stelle man in welchem feld ist.
  • und das formular sollte auf screen zentriert werden


EDIT: und eine funktion, eine lauffähige exe zu erstellen. machst du einfach so, dass du eine konsolen anwendnung mit dem kompletten interpreter schreibst, den BF code aus der ressource ausliest, dann beim kompilieren, diese exe an den zielordner verschiebst und den BF Code in die ressource injizierst.

ausblenden Quelltext
1:
++++++++++[>+++++++>++++++++++<<-]>--.>+.+++++++.++++.--------.+.					


und backslash hat auch viel zu viel feldverbrauch ;) liegt noch an den Hello World Resten, so:

ausblenden Quelltext
1:
++++++++++[>+++++++>++++++++++<<-]>----.>---.++.++++++++.++++++++.-------. -----------.++++++++++++++++++.-----------.					


ist das besser :P


mfg
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 08.04.07 19:09 
Einsteins berühmteste Feststellung:

ausblenden Version 1:
1:
2:
++++[>++++[>++++>++++>+++++++>++++++<<<<-]<-]>>
+++++.[-]>---.-[<+++>-]<-->>---.>+++.<<<.

ausblenden Version 2:
1:
2:
++++++[>++++++[>++>++>+++>+++<<<<-]>>-->>-<<<<<-]>>
---.[-]>+.-[<+++>-]<-->>+.>---.<<<.

(Benötigt die IDE, da die Konsole nen anderen Zeichensatz hat)

Bug:
Wenn man bei der Zeicheneingabe nichts eingibt und Enter drückt, bekommt man ne AV. Um das Enterzeichen zu simulieren sollte für eine leere Eingabe #10 oder #13 angenommen werden, oder alternativ der ASCII-Code auch wählbar sein.

Edit:
Hab mein BenBE-Programm von oben noch einmal kurz optimiert:
ausblenden Quelltext
1:
+++++[>++++[>+++>+++++>+++++<<<-]>+>>++<<<<-]>>+.>+.>.<<.+++.					

Ist sogar noch um ein Zeichen kürzer, als mein Optimierungs-Versuch davor (und führt das gleiche in ~40 Taketen weniger aus ^^

Edit 2:
Hier noch eins für Martok:
ausblenden Quelltext
1:
++++++++[>++++[>++>+++>+++<<<-]>++>>++<<<<-]>>---.>+.>++.++.-----.----.					

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.


Zuletzt bearbeitet von BenBE am So 08.04.07 23:16, insgesamt 3-mal bearbeitet
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: So 08.04.07 19:37 
die anzahl der zeichen auszugeben wäre auch noch ein kleines nettes feature, falls man was optimieren möchte.

mfg
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: So 08.04.07 23:13 
user profile iconMartok hat folgendes geschrieben:
EDIT: jetzt gehts auch..... sehr seltsam...

Um das letzte Zeichen zu interpretieren, muss ich immer ein weiteres anfügen, weshalb der . für das h flöten geht... :| Fehler in der interpretier-Schleife?
Edit: Eine Leertaste ans Ende des Programms genügt! => Deine Schleife muss bis length(code)-2 gehn oder soetwas :gruebel:

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 08.04.07 23:20 
Der Bug ist in der aktuellen Version bereits gefixt ... Kannst Du gern mit den ganzen Programmen von mir ausprobieren ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: So 08.04.07 23:25 
Holla! :oops:

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
andras
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 460

Win XP, Win Vista Home Premium, Ubuntu Dapper Drake
Delphi 2005 Pers
BeitragVerfasst: Mi 09.05.07 13:39 
hi!
super proggi, hätte nur einen wunsch:
wenn ich in einer endlosschleife hänge, wäre es super irgenwo einen stoppbutton zu haben, der das ganze abbricht.
ansonsten passt alles bei mir!
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mi 09.05.07 14:27 
(ich hab schonmal auf das thema geantwortet, irgendwie ist das wohl net angekommen ^^)

bei endlossschleifen klicke ich zweimal auf "schrittweise", dann hält er an.

mfg
andras
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 460

Win XP, Win Vista Home Premium, Ubuntu Dapper Drake
Delphi 2005 Pers
BeitragVerfasst: Do 10.05.07 13:44 
o.........dürft ich wohl beim überfiegen übersehen haben :oops:
Thx!!
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 10.05.07 15:56 
damit meinte ich, dass mein post hier irgendwie net steht, obwohl ich ihn abgeschickt habe