develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35398 - trunk/languages/pheme/lib

From:
fperrad
Date:
January 11, 2009 01:16
Subject:
[svn:parrot] r35398 - trunk/languages/pheme/lib
Message ID:
20090111091559.7F048CB9F9@x12.develooper.com
Author: fperrad
Date: Sun Jan 11 01:15:56 2009
New Revision: 35398

Removed:
   trunk/languages/pheme/lib/PhemeCompiler.pir
Modified:
   trunk/languages/pheme/lib/PhemeGrammar.pir
   trunk/languages/pheme/lib/PhemeObjects.pir
   trunk/languages/pheme/lib/PhemeSymbols.pir

Log:
[pheme]
- remove PhemeCompiler.pir (not used)
- detabify & minor beautification

Modified: trunk/languages/pheme/lib/PhemeGrammar.pir
==============================================================================
--- trunk/languages/pheme/lib/PhemeGrammar.pir	(original)
+++ trunk/languages/pheme/lib/PhemeGrammar.pir	Sun Jan 11 01:15:56 2009
@@ -1,13 +1,13 @@
 .namespace [ 'PhemeGrammar' ]
 
-.sub _load :load
-	load_bytecode 'PGE.pbc'
+.sub '_load' :load
+    load_bytecode 'PGE.pbc'
 
-	.local pmc pge_rule_class
-	.local pmc pheme_grammar_class
+    .local pmc pge_rule_class
+    .local pmc pheme_grammar_class
 
     pge_rule_class      = get_class ['PGE';'Grammar']
-	pheme_grammar_class = subclass pge_rule_class, 'PhemeGrammar'
+    pheme_grammar_class = subclass pge_rule_class, 'PhemeGrammar'
 .end
 
 .include "languages/pheme/lib/pheme_grammar_gen.pir"

Modified: trunk/languages/pheme/lib/PhemeObjects.pir
==============================================================================
--- trunk/languages/pheme/lib/PhemeObjects.pir	(original)
+++ trunk/languages/pheme/lib/PhemeObjects.pir	Sun Jan 11 01:15:56 2009
@@ -1,6 +1,6 @@
 .namespace [ 'Pheme'; 'Cons' ]
 
-.sub _initialize :anon :load :init
+.sub '_initialize' :anon :load :init
     .local pmc cons_class
     cons_class = get_class [ 'Pheme'; 'Cons' ]
     $I0 = defined cons_class
@@ -15,31 +15,31 @@
 .end
 
 .sub 'get_bool' :vtable
-	.return( 1 )
+    .return( 1 )
 .end
 
 .sub 'get_string' :vtable :method
-	.local pmc    head
-	.local string output
-	head    = self.'head'()
-
-	.local int head_defined
-	head_defined = defined head
-	unless head_defined goto return_it
-	output  = head
-
-	.local pmc tail
-	tail = self.'tail'()
-
-	.local string tail_output
-	tail_output = tail
-	unless tail_output goto return_it
+    .local pmc    head
+    .local string output
+    head    = self.'head'()
+
+    .local int head_defined
+    head_defined = defined head
+    unless head_defined goto return_it
+    output  = head
 
-	output .= ':'
-	output .= tail_output
+    .local pmc tail
+    tail = self.'tail'()
+
+    .local string tail_output
+    tail_output = tail
+    unless tail_output goto return_it
+
+    output .= ':'
+    output .= tail_output
 
   return_it:
-	.return( output )
+    .return( output )
 .end
 
 .sub 'head' :method
@@ -56,29 +56,29 @@
     .return( head )
 .end
 
-.sub get_integer :vtable :method
-	.local pmc elem
-	elem  = self.'head'()
+.sub 'get_integer' :vtable :method
+    .local pmc elem
+    elem  = self.'head'()
 
-	.local int elem_defined
-	elem_defined = defined elem
+    .local int elem_defined
+    elem_defined = defined elem
 
-	if elem_defined goto count_tail
-	.return( 0 )
+    if elem_defined goto count_tail
+    .return( 0 )
 
   count_tail:
-	.local int count
-	count = 0
-	elem  = self
+    .local int count
+    count = 0
+    elem  = self
 
   loop_start:
-	inc count
-	elem         = elem.'tail'()
-	elem_defined = defined elem
-	if elem_defined goto loop_start
+    inc count
+    elem         = elem.'tail'()
+    elem_defined = defined elem
+    if elem_defined goto loop_start
 
   loop_end:
-	.return( count )
+    .return( count )
 .end
 
 .sub 'tail' :method
@@ -97,18 +97,18 @@
 
 .namespace [ 'Pheme'; 'Atom' ]
 
-.sub _initialize :anon :load :init
-	.local pmc atom_class
-	newclass atom_class, [ 'Pheme'; 'Atom' ]
+.sub '_initialize' :anon :load :init
+    .local pmc atom_class
+    newclass atom_class, [ 'Pheme'; 'Atom' ]
 
-	addattribute atom_class, 'value'
+    addattribute atom_class, 'value'
 .end
 
 .namespace [ 'Pheme'; 'Atom'; 'Symbol' ]
 
-.sub _initialize :anon :load :init
-	.local pmc symbol_class
-	subclass symbol_class, [ 'Pheme'; 'Atom' ], [ 'Pheme'; 'Atom'; 'Symbol' ]
+.sub '_initialize' :anon :load :init
+    .local pmc symbol_class
+    subclass symbol_class, [ 'Pheme'; 'Atom' ], [ 'Pheme'; 'Atom'; 'Symbol' ]
 .end
 
 # Local Variables:

Modified: trunk/languages/pheme/lib/PhemeSymbols.pir
==============================================================================
--- trunk/languages/pheme/lib/PhemeSymbols.pir	(original)
+++ trunk/languages/pheme/lib/PhemeSymbols.pir	Sun Jan 11 01:15:56 2009
@@ -1,399 +1,399 @@
 .namespace [ 'PhemeCompiler' ]
 
-.sub __onload :anon :load :init
-	.local pmc symbols
-	symbols = new 'Hash'
-
-	symbols["'define'"]            = 1
-	symbols["'car'"]               = 1
-	symbols["'cdr'"]               = 1
-	symbols["'cons'"]              = 1
-	symbols["'cond'"]              = 1
-	symbols["'include_file'"]      = 1
-	symbols["'write'"]             = 1
-	symbols["'+'"]                 = 1
-	symbols["'-'"]                 = 1
-	symbols["'*'"]                 = 1
-	symbols["'/'"]                 = 1
+.sub '__onload' :anon :load :init
+    .local pmc symbols
+    symbols = new 'Hash'
+
+    symbols["'define'"]            = 1
+    symbols["'car'"]               = 1
+    symbols["'cdr'"]               = 1
+    symbols["'cons'"]              = 1
+    symbols["'cond'"]              = 1
+    symbols["'include_file'"]      = 1
+    symbols["'write'"]             = 1
+    symbols["'+'"]                 = 1
+    symbols["'-'"]                 = 1
+    symbols["'*'"]                 = 1
+    symbols["'/'"]                 = 1
 
-	set_hll_global ['PhemeCompiler'], 'symbols', symbols
-	.return()
+    set_hll_global ['PhemeCompiler'], 'symbols', symbols
+    .return()
 .end
 
 .namespace [ 'Pheme' ]
 
-.sub __resolve_at_runtime :multi( [ 'Pheme'; 'Cons' ] )
-	.param pmc args :slurpy
+.sub '__resolve_at_runtime' :multi( [ 'Pheme'; 'Cons' ] )
+    .param pmc args :slurpy
 
-	.tailcall __list_to_cons( args :flat )
+    .tailcall __list_to_cons( args :flat )
 .end
 
-.sub __resolve_at_runtime :multi( string )
-	.param string symbol_name
-	.param pmc    args :slurpy
+.sub '__resolve_at_runtime' :multi( string )
+    .param string symbol_name
+    .param pmc    args :slurpy
 
-	.local pmc function
-	push_eh return_list
-	function = get_global symbol_name
-	unless function goto return_list
-	pop_eh
+    .local pmc function
+    push_eh return_list
+    function = get_global symbol_name
+    unless function goto return_list
+    pop_eh
 
-	.tailcall function( args :flat )
+    .tailcall function( args :flat )
 
   return_list:
-	.tailcall __list_to_cons( symbol_name, args :flat )
+    .tailcall __list_to_cons( symbol_name, args :flat )
 .end
 
-.sub __list_to_cons
-	.param pmc args :slurpy
+.sub '__list_to_cons'
+    .param pmc args :slurpy
 
-	.local pmc result
-	result = new [ 'Pheme'; 'Cons' ]
+    .local pmc result
+    result = new [ 'Pheme'; 'Cons' ]
 
-	.local int args_count
-	.local pmc arg
+    .local int args_count
+    .local pmc arg
 
   loop_start:
-	args_count = args
-	unless args_count goto loop_end
-	arg        = pop args
-	result     = cons( arg, result )
-	goto loop_start
+    args_count = args
+    unless args_count goto loop_end
+    arg        = pop args
+    result     = cons( arg, result )
+    goto loop_start
 
   loop_end:
-  	.return( result )
+    .return( result )
 .end
 
 .sub '__evaluate' :multi( [ 'Pheme'; 'Cons' ] )
-	.param pmc cons
+    .param pmc cons
 
-	.local pmc cons_list
-	cons_list = new 'ResizablePMCArray'
+    .local pmc cons_list
+    cons_list = new 'ResizablePMCArray'
 
-	# walk through cons
-	# push onto stack backwards
-	# evaluate that way
-	.local pmc head
-	.local int item_defined
+    # walk through cons
+    # push onto stack backwards
+    # evaluate that way
+    .local pmc head
+    .local int item_defined
   get_loop:
-	head = cons.'head'()
-	item_defined = defined head
-	unless item_defined goto end_get_loop
-	push cons_list, head
+    head = cons.'head'()
+    item_defined = defined head
+    unless item_defined goto end_get_loop
+    push cons_list, head
 
-	cons = cons.'tail'()
-	goto get_loop
+    cons = cons.'tail'()
+    goto get_loop
   end_get_loop:
 
-	.local pmc first
-	first = cons_list[0]
+    .local pmc first
+    first = cons_list[0]
 
-	.local string first_type
-	first_type = typeof first
+    .local string first_type
+    first_type = typeof first
 
-	if first_type == 'String' goto call_func
+    if first_type == 'String' goto call_func
 
-	.tailcall __list_to_cons( cons_list :flat )
+    .tailcall __list_to_cons( cons_list :flat )
 
   call_func:
-	first  = shift cons_list
+    first  = shift cons_list
 
-	.local string func_name
-	func_name = first
+    .local string func_name
+    func_name = first
 
-	.tailcall __resolve_at_runtime( func_name, cons_list :flat )
+    .tailcall __resolve_at_runtime( func_name, cons_list :flat )
 .end
 
 .sub '__evaluate' :multi( pmc )
-	.param pmc atom
-	.return( atom )
+    .param pmc atom
+    .return( atom )
 .end
 
-.sub car
-	.param pmc cons
+.sub 'car'
+    .param pmc cons
 
-	.local pmc head
-	head = cons.'head'()
+    .local pmc head
+    head = cons.'head'()
 
-	.local int defined_head
-	defined_head = defined head
+    .local int defined_head
+    defined_head = defined head
 
-	unless defined_head goto return_nil
-	.return( head )
+    unless defined_head goto return_nil
+    .return( head )
 
   return_nil:
-	.return( 'nil' )
+    .return( 'nil' )
 .end
 
-.sub cdr
-	.param pmc cons
+.sub 'cdr'
+    .param pmc cons
 
-	.local pmc tail
-	.tailcall cons.'tail'()
+    .local pmc tail
+    .tailcall cons.'tail'()
 .end
 
-.sub include_file
-	.param pmc file_path
+.sub 'include_file'
+    .param pmc file_path
 
-	.local string filename
-	filename = file_path
+    .local string filename
+    filename = file_path
 
-	load_bytecode filename
-	.return()
+    load_bytecode filename
+    .return()
 .end
 
-.sub cons
-	.param pmc l
-	.param pmc r
+.sub 'cons'
+    .param pmc l
+    .param pmc r
 
-	.local pmc result
-	result = new [ 'Pheme'; 'Cons' ]
+    .local pmc result
+    result = new [ 'Pheme'; 'Cons' ]
 
-	result.'head'( l )
-	result.'tail'( r )
+    result.'head'( l )
+    result.'tail'( r )
 
-	.return( result )
+    .return( result )
 .end
 
 .sub 'cond'
-	.param pmc exps :slurpy
+    .param pmc exps :slurpy
 
-	.local pmc iter
-	iter = new 'Iterator', exps
-	iter = 0
+    .local pmc iter
+    iter = new 'Iterator', exps
+    iter = 0
 
-	.local pmc cond
-	.local pmc action
+    .local pmc cond
+    .local pmc action
 
   iter_loop:
-	unless iter goto iter_end
-	cond   = shift iter
-	action = shift iter
-
-	.local pmc result
-	result = __evaluate( cond )
-	unless result goto iter_loop
+    unless iter goto iter_end
+    cond   = shift iter
+    action = shift iter
+
+    .local pmc result
+    result = __evaluate( cond )
+    unless result goto iter_loop
 
-	.tailcall __evaluate( action )
+    .tailcall __evaluate( action )
 
   iter_end:
-	.return()
+    .return()
 .end
 
 .sub 'write' :multi()
-	.param pmc messages :slurpy
+    .param pmc messages :slurpy
 
-	.local string message
-	.local pmc iter
-	iter = new 'Iterator', messages
-	iter = 0
+    .local string message
+    .local pmc iter
+    iter = new 'Iterator', messages
+    iter = 0
 
   iter_loop:
-	unless iter goto iter_end
-	message = shift iter
-	print message
-	goto iter_loop
+    unless iter goto iter_end
+    message = shift iter
+    print message
+    goto iter_loop
 
   iter_end:
-	.return()
+    .return()
 .end
 
 .sub 'eqlist?'
-	.param pmc l_cons
-	.param pmc r_cons
+    .param pmc l_cons
+    .param pmc r_cons
 
-	.local int l_count
-	.local int r_count
-	l_count = l_cons
-	r_count = r_cons
-
-	unless l_count == 0 goto not_empty
-	unless r_count == 0 goto not_empty
-	.return( 1 )
+    .local int l_count
+    .local int r_count
+    l_count = l_cons
+    r_count = r_cons
+
+    unless l_count == 0 goto not_empty
+    unless r_count == 0 goto not_empty
+    .return( 1 )
 
   not_empty:
-	if l_count == r_count goto compare_head
-	.return( 0 )
+    if l_count == r_count goto compare_head
+    .return( 0 )
 
   compare_head:
-	.local pmc l_head
-	.local pmc r_head
+    .local pmc l_head
+    .local pmc r_head
 
-	l_head = l_cons.'head'()
-	r_head = r_cons.'head'()
+    l_head = l_cons.'head'()
+    r_head = r_cons.'head'()
 
-	.local int head_equal
-	head_equal = 'eq?'( l_head, r_head )
+    .local int head_equal
+    head_equal = 'eq?'( l_head, r_head )
 
-	if head_equal goto compare_tail
-	.return( 0 )
+    if head_equal goto compare_tail
+    .return( 0 )
 
   compare_tail:
-	.local pmc l_tail
-	.local pmc r_tail
+    .local pmc l_tail
+    .local pmc r_tail
 
-	l_tail = l_cons.'tail'()
-	r_tail = r_cons.'tail'()
+    l_tail = l_cons.'tail'()
+    r_tail = r_cons.'tail'()
 
-	.tailcall 'eqlist?'( l_head, r_head )
+    .tailcall 'eqlist?'( l_head, r_head )
 .end
 
 .sub 'eq?' :multi( pmc, pmc )
-	.param pmc l_atom
-	.param pmc r_atom
+    .param pmc l_atom
+    .param pmc r_atom
 
-	eq l_atom, r_atom, return_true
-	.return( 0 )
+    eq l_atom, r_atom, return_true
+    .return( 0 )
 
   return_true:
-	.return( 1 )
+    .return( 1 )
 .end
 
 .sub 'eq?' :multi( [ 'Pheme'; 'Cons' ], [ 'Pheme'; 'Cons' ] )
-	.param pmc l_cons
-	.param pmc r_cons
+    .param pmc l_cons
+    .param pmc r_cons
 
-	.tailcall 'eqlist?'( l_cons, r_cons )
+    .tailcall 'eqlist?'( l_cons, r_cons )
 .end
 
 # XXX - return #t
 .sub 'atom?' :multi( [ 'Pheme'; 'Atom' ] )
-	.param pmc atom
+    .param pmc atom
 
-	.return( 1 )
+    .return( 1 )
 .end
 
 # XXX - return #f
 .sub 'atom?' :multi( [ 'Pheme'; 'Cons' ] )
-	.param pmc cons
+    .param pmc cons
 
-	.return( 0 )
+    .return( 0 )
 .end
 
 # XXX - a cheat for now
 .sub 'atom?' :multi( String )
-	.param pmc val
-	.return( 1 )
+    .param pmc val
+    .return( 1 )
 .end
 
 # XXX - a cheat for now
 .sub 'atom?' :multi( string )
-	.param pmc val
-	.return( 1 )
+    .param pmc val
+    .return( 1 )
 .end
 
 .sub 'null?' :multi( [ 'Pheme'; 'Cons' ] )
-	.param pmc cons
-	.local int count
-	count = cons
+    .param pmc cons
+    .local int count
+    count = cons
 
-	eq count, 0, indeed_empty
-	.return( 0 )
+    eq count, 0, indeed_empty
+    .return( 0 )
 
   indeed_empty:
-	.return( 1 )
+    .return( 1 )
 .end
 
 .sub '+' :multi( _ )
-	.param num first
-	.param pmc   rest   :slurpy
+    .param num first
+    .param pmc   rest   :slurpy
 
-	.local num result
-	result   = first
+    .local num result
+    result   = first
 
-	.local pmc iter
-	iter = new 'Iterator', rest
+    .local pmc iter
+    iter = new 'Iterator', rest
 
-	.local pmc   next
-	.local num next_val
+    .local pmc   next
+    .local num next_val
 
   loop:
- 	unless iter goto end_loop
-	next     = shift iter
-	next_val = next
-	result  += next_val
-	goto loop
+    unless iter goto end_loop
+    next     = shift iter
+    next_val = next
+    result  += next_val
+    goto loop
 
   end_loop:
-	.return( result )
+    .return( result )
 .end
 
 .sub '*' :multi( _ )
-	.param num first
-	.param pmc   rest   :slurpy
+    .param num first
+    .param pmc   rest   :slurpy
 
-	.local num result
-	result   = first
+    .local num result
+    result   = first
 
-	.local pmc iter
-	iter = new 'Iterator', rest
+    .local pmc iter
+    iter = new 'Iterator', rest
 
-	.local pmc   next
-	.local num next_val
+    .local pmc   next
+    .local num next_val
 
   loop:
- 	unless iter goto end_loop
-	next     = shift iter
-	next_val = next
-	result  *= next_val
-	goto loop
+    unless iter goto end_loop
+    next     = shift iter
+    next_val = next
+    result  *= next_val
+    goto loop
 
   end_loop:
-	.return( result )
+    .return( result )
 .end
 
 .sub '-' :multi( _ )
-	.param num first
-	.param pmc   rest :slurpy
+    .param num first
+    .param pmc   rest :slurpy
 
-	.local num result
-	result   = first
+    .local num result
+    result   = first
 
-	.local pmc iter
-	iter = new 'Iterator', rest
+    .local pmc iter
+    iter = new 'Iterator', rest
 
-	.local pmc   next
-	.local num next_val
+    .local pmc   next
+    .local num next_val
 
   loop:
- 	unless iter goto end_loop
-	next     = shift iter
-	next_val = next
-	result  -= next_val
-	goto loop
+    unless iter goto end_loop
+    next     = shift iter
+    next_val = next
+    result  -= next_val
+    goto loop
 
   end_loop:
-	.return( result )
+    .return( result )
 .end
 
 .sub '/'
-	.param num l
-	.param num r
+    .param num l
+    .param num r
 
-	.local num result
-	result = l / r
+    .local num result
+    result = l / r
 
-	.return( result )
+    .return( result )
 .end
 
 .sub 'null?' :multi( _ )
-	.param pmc dummy
-	.return( 0 )
+    .param pmc dummy
+    .return( 0 )
 .end
 
 .sub 'write' :multi( string )
-	.param string message_string
+    .param string message_string
 
-	print message_string
-	.return()
+    print message_string
+    .return()
 .end
 
 .sub '__make_empty_cons'
-	.local pmc result
+    .local pmc result
 
-	.local pmc result
-	result = new [ 'Pheme'; 'Cons' ]
-	.return( result )
+    .local pmc result
+    result = new [ 'Pheme'; 'Cons' ]
+    .return( result )
 .end
 
 # Local Variables:



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About