In C code I can have assembly code with this syntax :
asm function_declaration
{
assembly instruction
...
assembly instruction
}
In the file cparse.py I make a declaration of "asm
function_declaration", but I do not see how to define the rule to
take all the lines between '{' and '}' to be treated without having to
declare all assembly code op.
The "function_declaration" is standard C function_declaration, with or
without parameters and return or not.
I use PLY 2.5
extract of my code in cparse.py
# asm function declaration
def p_asm_function_definition_1(t):
'asm_function_definition : ASM declaration_specifiers declarator
asm_compound_statement'
def p_asm_function_definition_2(t):
'asm_function_definition : ASM declarator declaration_list
asm_compound_statement'
def p_asm_function_definition_3(t):
'asm_function_definition : ASM declarator asm_compound_statement'
def p_asm_function_definition_4(t):
'asm_function_definition : declaration_specifiers declarator
asm_compound_statement'
# asm compound statement
def p_asm_compound_statement(t):
'asm_compound_statement : LBRACE asm_statement_list RBRACE'
# asm_statement-list:
def p_asm_statement_list_1(t):
'asm_statement_list : asm_statement'
def p_asm_statement_list_2(t):
'asm_statement_list : asm_statement_list asm_statement'
# asm_statement
def p_asm_statement(t):
'asm_statement : asm_code asm_operande'
# asm_code
def p_asm_code(t):
'asm_code : all asm code op ????
# asm_operande
def p_asm_operande(t):
'asm_operande : all operande possible ????
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---