2012年11月9日 星期五

[ Forth.js ] Version 1.0.1

Jimmy's papa在本機測試include指令沒問題,不過貼到部落格倒是怪怪的,可能與某些東西衝突到了,有空再除錯


JimmyScratchLab Forth.js(a fork of JeForth) Demo

Example: Append to TagId='div1':
    <script type="text/forth">
         : c c" pi = 3.14" >tag h1   >tag div >tagid div1 ;  c
    </script>
    <div id='div1'></div>



Example: Show Table
<script type="text/forth">
    : showtable     c" WORD" >tag th >tag tr c" Stack" >tag th >tagnode  >tagid table1
         c" .tag" >tag td >tag tr c" ( str <tagname> --  )" >tag td >tagnode  >tagid table1
         c" >tagid" >tag td >tag h1 >tag tr c" ( x|node <tagid> --  )" >tag td >tagnode  >tagid table1    
         c" >tag" >tag td >tag tr c" ( x|node <tag> -- node )" >tag td >tagnode  >tagid table1 
         c" >tagnode" >tag td >tag tr c" ( node x|childnode -- node )" >tag td >tagnode  >tagid table1
    ;   showtable 
    </script>
    <table id='table1' border="1"></table>



Example: include
    <script type="text/forth">
         c" ./forth/testcase.f" include
    </script>
    <p class="forth" forthcode=" x "> </p>

nil




Example: 9*9
<p class="forth" forthcode=": 9*9 9 for cr r@ 9 for dup r@ * 2 .r space next drop next ; 9*9">nil</p>

nil




Example: fib1
<p class="forth" forthcode=" : fib1 1 1 begin over . swap over + dup 10000 > until 2drop ; fib1">nil</p>

nil




Example: fib2
<p class="forth" forthcode=" fib2 ">nil</p>

nil




Example: abs
<p class="forth" forthcode='-16 abs -20 abs -12 abs -9 abs -3 abs -11 abs -8 abs .s c" abs ok!" .tag h1'>nil</p>

nil




Example: version
<p class="forth" forthcode=" .( *** ) version . .( *** ) ">nil</p>

nil

沒有留言:

張貼留言