Added truth machine example and fixed an interpreter glitch

This commit is contained in:
izumariu 2018-06-14 19:50:06 +02:00
parent da1768a57f
commit c5df3b28be
3 changed files with 53 additions and 5 deletions

19
compiler_template.s Normal file
View File

@ -0,0 +1,19 @@
.text
.global _start
_start:
mov $1, %rax
mov $1, %rdi
mov $msg, %rsi
mov $msl, %rdx
syscall
mov $60, %rax
xor %rdi, %rdi
syscall
msg:
.ascii "Hello world!"
.set msgl, .-msg
.bss

13
examples/truthmachine.fap Normal file
View File

@ -0,0 +1,13 @@
It is June 13th, 2018, 08:42:40 AM. Izu is in his bed, bored. His secret
kinks are balloons, rubber, fat, thighs, butts and moobs. Suddenly the following sounds become audible.
oh balloons,hnng rubber,hnng thighs,hnng
hrg
fat,hnng fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap
hrg
yes
mmf
mmf
fat,hnng fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap yes sigh

View File

@ -50,10 +50,10 @@ PRONOUNS={
->{
_phrase = $CONTENT.shift.strip
if _phrase.match /^(Then|Suddenly)/
if _phrase.match /^(Then|Suddenly)\\s+the/
_rxp=Regexp.new("^(Then|Suddenly)\\s+#{PRONOUNS[GENDER][:personal]}\\s+spot#{PRONOUNS[GENDER][:verb_suffix]}\\s+(.+)$", Regexp::MULTILINE)
_m = _phrase.match _rxp
_m||abort("OOPS WRONG SYNTAX IN FOURTH INTRO SENTENCE")
_m||abort("OOPS WRONG SYNTAX IN FOURTH INTRO SENTENCE (#{_phrase.inspect})")
$REGS[0] = 2**(KINKS.index(_m[2].downcase)+2)
else
$CONTENT.unshift _phrase
@ -64,7 +64,7 @@ PRONOUNS={
_phrase = $CONTENT.shift.strip
_rxp=Regexp.new("^(Soon|Then|Suddenly)\\s+the\\s+following\\s+sounds\\s+become\\s+audible$", Regexp::MULTILINE)
_m = _phrase.match _rxp
_m||abort("OOPS WRONG SYNTAX IN #{$REGS[0]==0 ? "FOURTH" : "FIFTH"} INTRO SENTENCE")
_m||abort("OOPS WRONG SYNTAX IN #{$REGS[0]==0 ? "FOURTH" : "FIFTH"} INTRO SENTENCE (#{_phrase.inspect})")
}.call
$CONTENT = $CONTENT.join(".").gsub(/ngh.+hhh/,"").gsub(/\s+/," ").strip.split
@ -102,9 +102,25 @@ until $IPTR == $CONTENT.length
when /^yes$/i
putc $REGS[$REGPTR]
when /^oh$/i
$REGS[$REGPTR] = gets.chomp[0]
$REGS[$REGPTR] = gets.chomp[0].ord
when /^hrg$/i
$RETSTACK << $IPTR
unless $REGS[$REGPTR] == 0
$RETSTACK << $IPTR
else
->{
_depth = $RETSTACK.length
_current = _depth+1
until _depth == _current
$IPTR += 1
$CONTENT[$IPTR].match(/^hrg$/i)&&(_current+=1;next)
$CONTENT[$IPTR].match(/^mmf$/i)&&(_current-=1;next)
end
}.call
end
when /^mmf$/i
$REGS[$REGPTR] == 0 ? $RETSTACK.pop : $IPTR=$RETSTACK[-1]
when /^squirt$/i