~ubuntu-branches/ubuntu/vivid/nqp/vivid-proposed

« back to all changes in this revision

Viewing changes to src/NQP/Compiler.nqp

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-11-01 12:09:18 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131101120918-kx51sl0sxl3exsxi
Tags: 2013.10-1
* New upstream release
* Bump versioned (Build-)Depends on parrot
* Update patches
* Install new README.pod
* Fix vcs-field-not-canonical
* Do not install rubyish examples
* Do not Depends on parrot-devel anymore
* Add 07_disable-serialization-tests.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use QRegex;
 
2
 
 
3
class NQP::Compiler is HLL::Compiler {
 
4
    method optimize($past, *%adverbs) {
 
5
        %adverbs<optimize> eq 'off'
 
6
            ?? $past
 
7
            !! NQP::Optimizer.new.optimize($past, |%adverbs)
 
8
    }
 
9
}
 
10
 
 
11
# Create and configure compiler object.
 
12
my $nqpcomp := NQP::Compiler.new();
 
13
$nqpcomp.language('nqp');
 
14
$nqpcomp.parsegrammar(NQP::Grammar);
 
15
$nqpcomp.parseactions(NQP::Actions);
 
16
hll-config($nqpcomp.config);
 
17
 
 
18
$nqpcomp.addstage('optimize', :after<ast>);
 
19
 
 
20
# Add extra command line options.
 
21
my @clo := $nqpcomp.commandline_options();
 
22
@clo.push('parsetrace');
 
23
@clo.push('setting=s');
 
24
@clo.push('setting-path=s');
 
25
@clo.push('module-path=s');
 
26
@clo.push('no-regex-lib');
 
27
@clo.push('stable-sc');
 
28
@clo.push('optimize=s');
 
29
#?if parrot
 
30
@clo.push('vmlibs=s');
 
31
@clo.push('dynext=s');
 
32
#?endif
 
33
#?if jvm
 
34
@clo.push('javaclass=s');
 
35
@clo.push('bootstrap');
 
36
$nqpcomp.addstage('classname', :after<start>);
 
37
#?endif
 
38
#?if moar
 
39
@clo.push('bootstrap');
 
40
#?endif
 
41
 
 
42
#?if parrot
 
43
# XXX FIX ME
 
44
sub MAIN(@ARGS) {
 
45
#?endif
 
46
#?if moar
 
47
# XXX FIX ME
 
48
sub MAIN(@ARGS) {
 
49
#?endif
 
50
#?if jvm
 
51
sub MAIN(*@ARGS) {
 
52
#?endif
 
53
    # Enter the compiler.
 
54
    $nqpcomp.command_line(@ARGS, :encoding('utf8'), :transcode('ascii iso-8859-1'));
 
55
 
 
56
    # Uncomment below to dump cursor usage logging (also need to uncomment two lines
 
57
    # in src/QRegex/Cursor.nqp, in !cursor_start_cur and !cursor_start_all).
 
58
    #ParseShared.log_dump();
 
59
 
 
60
    # Close event logging
 
61
    $nqpcomp.nqpevent();
 
62
}