~dexter/parrot-pkg/maverick

« back to all changes in this revision

Viewing changes to compilers/imcc/imcc.y

  • Committer: Piotr Roszatycki
  • Date: 2011-01-11 14:34:28 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: piotr.roszatycki@gmail.com-20110111143428-s7pa7qz38m61o4tw
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 *
10
10
 * Grammar of the PIR language parser.
11
11
 *
12
 
 * $Id: imcc.y 48942 2010-09-11 22:53:19Z NotFound $
13
12
 *
14
13
 */
15
14
 
971
970
{
972
971
    ASSERT_ARGS(do_loadlib)
973
972
    STRING * const s       = Parrot_str_unescape(interp, lib + 1, '"', NULL);
974
 
    PMC    * const lib_pmc = Parrot_load_lib(interp, s, NULL);
 
973
    PMC    * const lib_pmc = Parrot_dyn_load_lib(interp, s, NULL);
975
974
    if (PMC_IS_NULL(lib_pmc) || !VTABLE_get_bool(interp, lib_pmc)) {
976
975
        IMCC_fataly(interp, EXCEPTION_LIBRARY_ERROR,
977
976
            "loadlib directive could not find library `%S'", s);
978
977
    }
979
 
    Parrot_register_HLL_lib(interp, s);
 
978
 
 
979
    /* store non-dynoplib library deps here, dynoplibs are treated separately for now */
 
980
    if (!STRING_equal(interp,
 
981
            VTABLE_get_string(interp,
 
982
                VTABLE_getprop(interp, lib_pmc, Parrot_str_new_constant(interp, "_type"))),
 
983
            Parrot_str_new_constant(interp, "Ops")))
 
984
        imcc_pbc_add_libdep(interp, s);
980
985
}
981
986
 
982
987
/* HEADERIZER STOP */
1012
1017
%token <t> POW SHIFT_RIGHT_U LOG_AND LOG_OR
1013
1018
%token <t> COMMA ESUB DOTDOT
1014
1019
%token <t> PCC_BEGIN PCC_END PCC_CALL PCC_SUB PCC_BEGIN_RETURN PCC_END_RETURN
1015
 
%token <t> PCC_BEGIN_YIELD PCC_END_YIELD NCI_CALL METH_CALL INVOCANT
 
1020
%token <t> PCC_BEGIN_YIELD PCC_END_YIELD INVOCANT
1016
1021
%token <t> MAIN LOAD INIT IMMEDIATE POSTCOMP METHOD ANON OUTER NEED_LEX
1017
1022
%token <t> MULTI VTABLE_METHOD LOADLIB SUB_INSTANCE_OF SUBID
1018
1023
%token <t> NS_ENTRY
1019
 
%token <t> UNIQUE_REG
1020
1024
%token <s> LABEL
1021
1025
%token <t> EMIT EOM
1022
1026
%token <s> IREG NREG SREG PREG IDENTIFIER REG MACRO ENDM
1023
1027
%token <s> STRINGC INTC FLOATC USTRINGC
1024
1028
%token <s> PARROT_OP
1025
 
%type <t> type hll_def return_or_yield comma_or_goto opt_unique_reg
 
1029
%type <t> type hll_def return_or_yield comma_or_goto
1026
1030
%type <i> program
1027
1031
%type <i> class_namespace
1028
1032
%type <i> constdef sub emit pcc_ret pcc_yield
1148
1152
         {
1149
1153
            STRING * const hll_name = Parrot_str_unescape(interp, $2 + 1, '"', NULL);
1150
1154
            Parrot_pcc_set_HLL(interp, CURRENT_CONTEXT(interp),
1151
 
                Parrot_register_HLL(interp, hll_name));
 
1155
                Parrot_hll_register_HLL(interp, hll_name));
1152
1156
 
1153
1157
            IMCC_INFO(interp)->cur_namespace = NULL;
1154
1158
            mem_sys_free($2);
1580
1584
         {
1581
1585
           add_pcc_sub(IMCC_INFO(interp)->cur_call, $2);
1582
1586
         }
1583
 
   | NCI_CALL var '\n'
1584
 
         {
1585
 
           add_pcc_sub(IMCC_INFO(interp)->cur_call, $2);
1586
 
         }
1587
 
   | METH_CALL target '\n'
1588
 
         {
1589
 
           add_pcc_sub(IMCC_INFO(interp)->cur_call, $2);
1590
 
         }
1591
 
   | METH_CALL STRINGC '\n'
1592
 
         {
1593
 
           add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, $2, 'S'));
1594
 
         }
1595
 
   | METH_CALL target COMMA var '\n'
1596
 
         {
1597
 
           add_pcc_sub(IMCC_INFO(interp)->cur_call, $2);
1598
 
           add_pcc_cc(IMCC_INFO(interp)->cur_call, $4);
1599
 
         }
1600
 
   | METH_CALL STRINGC COMMA var '\n'
1601
 
         {
1602
 
           add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, $2, 'S'));
1603
 
           add_pcc_cc(IMCC_INFO(interp)->cur_call, $4);
1604
 
         }
1605
 
   ;
1606
1587
 
1607
1588
 
1608
1589
pcc_args:
1657
1638
   | ADV_NAMED                  { $$ = VT_NAMED; }
1658
1639
   | ADV_NAMED '(' STRINGC ')'  { adv_named_set(interp, $3);   $$ = VT_NAMED; mem_sys_free($3); }
1659
1640
   | ADV_NAMED '(' USTRINGC ')' { adv_named_set_u(interp, $3); $$ = VT_NAMED; mem_sys_free($3); }
1660
 
   | UNIQUE_REG                 { $$ = 0; }
1661
1641
   | ADV_CALL_SIG               { $$ = VT_CALL_SIG; }
1662
1642
   ;
1663
1643
 
1845
1825
   ;
1846
1826
 
1847
1827
id_list_id :
1848
 
     IDENTIFIER opt_unique_reg
 
1828
     IDENTIFIER
1849
1829
         {
1850
1830
           IdList* const l = mem_gc_allocate_n_zeroed_typed(interp, 1, IdList);
1851
1831
           l->id           = $1;
1853
1833
         }
1854
1834
   ;
1855
1835
 
1856
 
opt_unique_reg:
1857
 
     /* empty */
1858
 
   | UNIQUE_REG
1859
 
   ;
1860
 
 
1861
 
 
1862
1836
labeled_inst:
1863
1837
     assignment
1864
1838
   | conditional_statement
2443
2417
 * Local variables:
2444
2418
 *   c-file-style: "parrot"
2445
2419
 * End:
2446
 
 * vim: expandtab shiftwidth=4:
 
2420
 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
2447
2421
 */