# New Ticket Created by Klaas-Jan Stol # Please include the string: [perl #41636] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41636 >
hi, attached a patch for pdd06 (pasm). fixing: * change ".sub" into ".pcc_sub"; ".sub" is illegal in pasm mode * added constant directive * added description of flags available to tag .pcc_sub's * added grammar overview I'm not sure if this patch is good enough. Let me know if anything should change. Also, the grammar overview may not be complete, but I can't find where pasm is parsed; it's done through IMCC, but understanding imcc.y is a pain. regards, kjs
Index: docs/pdds/draft/pdd06_pasm.pod =================================================================== --- docs/pdds/draft/pdd06_pasm.pod (revision 17213) +++ docs/pdds/draft/pdd06_pasm.pod (working copy) @@ -50,28 +50,68 @@ All assembly opcodes contain only ASCII lowercase letters, digits, and the underscore. -Upper case names are reserved for assembler directives. {{ NOTE: no -longer true. }} +Assembler directives are prefixed with a dot. These directives are instructions +for the assembler and may or may not translate to a PASM instruction. Labels all end with a colon. They may have ASCII letters, numbers, and -underscores in them. Labels that begin with a dollar sign (the only valid spot -in a label a dollar sign can appear) are private to the subroutine they appear -in. +underscores in them. Namespaces are noted with the C<.namespace> directive. It takes a single parameter, the name of the namespace, in the form of a multi-dimensional key. -Subroutine names are noted with the C<.sub> directive. It takes a +Constants can be declared with the C<.constant> directive. It takes two +parameters: the name of the constant and the value. + +Subroutine names are noted with the C<.pcc_sub> directive. It takes a single parameter, the name of the subroutine, which is added to the namespace's symbol table. Sub names may be any valid Unicode -alphanumeric character and the underscore. +alphanumeric character and the underscore. The C<.pcc_sub> directive +may take flags to indicate when the sub should be invoked. The following +flags are available: C<:main> to indicate that execution should start +at the specified subroutine; C<:immediate> or C<:postcomp> to indicate +that the sub should be run immediately after compilation; C<:load> to +indicate that the sub should be executed when its bytecode segment is +loaded; C<:init> to indicate the sub should be run when the file is run +directly. Constants don't need to be named and put in a separate section of the assembly source. The assembler will take care of putting them in the appropriate part of the generated bytecode. +Below is an overview of the grammar of a PASM file. + pasm_file: + [ pasm_line '\n' ]* + + pasm_line: + pasm_instruction + | constant_directive + | namespace_directive + + pasm_instruction: + [ [ sub_directive ]? label ]? instruction + + sub_directive: + ".pcc_sub" [ sub_flag ]? + + sub_flag: + ":init" | ":main" | ":load" | ":postcomp" | ":immediate" + + label: + identifier ":" + + constant_directive: + ".constant" identifier literal + + namespace_directive: + ".namespace" "[" multi_dimensional_key "]" + + multi_dimensional_key: + quoted_string [ ";" quoted_string ]* + + + =head1 OPCODE LIST In the following list, there may be multiple (but unlisted) versions of an @@ -823,7 +863,7 @@ =head2 Key operations -Keys are used to get access to individual elements of an aggregate variable. +Keys are used to get access to individual elements of an aggregate variable. This is done to allow for opaque, packed, and multidimensional aggregate types. A key entry may be an integer, string, or PMC. Integers are used for array @@ -1085,16 +1125,16 @@ =head1 VERSION -None. +1.9 =head2 CURRENT Maintainer: Dan Sugalski Class: Internals PDD Number: 6 - Version: 1.8 + Version: 1.9 Status: Developing - Last Modified: 02 December 2002 + Last Modified: 28 February 2007 PDD Format: 1 Language: English @@ -1102,6 +1142,10 @@ =over 4 +=item Version 1.9 + +February 28, 2007 + =item Version 1.8 December 11, 2002 @@ -1144,6 +1188,20 @@ =over 4 +=item Version 1.9 + +=over 4 + +=item * Removed remark on "upper case names reserved for directives" + +=item * Fixed ".sub" directive, should be ".pcc_sub" + +=item * Added constant directive in description. + +=item * Added grammar overview. + +=back + =item Version 1.8 =over 4 @@ -1160,11 +1218,8 @@ =over 4 -=item * Fixed stack ops +=item * Fixed stack ops; push, pop, and clear properly documented according to the engine's behaviour now. -push, pop, and clear properly documented according to the engine's behaviour -now. - =back =item Version 1.6