On Saturday 15 December 2007 14:58:01 Patrick R. Michaud wrote:

> While at a meeting today I had a period of time where I couldn't
> easily sync with the Parrot repository to work on it, so I hacked
> together a small script to automatically populate a new languages/
> subdirectory with a "standard" compiler tools setup.  The script
> is attached.
>
> With this script, one can do:
>
>     $ perl tools/dev/mk_language_shell.pl Xyz
>
> The script will automatically create a languages/xyz/
> directory with the following files (all customized to the
> language being created):
>
>     xyz.pir
>     config/makefiles/root.in
>     src/parser/grammar.pg
>     src/parser/actions.pm
>     src/builtins/say.pir
>     t/harness
>     t/00-sanity.t
>
> The script also runs the reconfigure step on the directory
> to produce a Makefile from config/makefiles/root.in .  So,
> after running the above to create a compiler shell for 'Xyz',
> one can immediately do:
>
>     $ cd languages/xyz
>     $ make test
>     ../../parrot 
> /home/pmichaud/parrot/trunk/runtime/parrot/library/PGE/Perl6Grammar.pbc \
> --output=src/gen_grammar.pir \
>                 src/parser/grammar.pg
>     ../../parrot  /home/pmichaud/parrot/trunk/compilers/nqp/nqp.pbc
> --output=src/gen_actions.pir \ --target=pir src/parser/actions.pm
>     /usr/bin/perl -MExtUtils::Command -e cat src/builtins/say.pir 
> >src/gen_builtins.pir ../../parrot  -o xyz.pbc xyz.pir
>     /usr/bin/perl t/harness
>     t/00-sanity......ok
>     All tests successful.
>     Files=1, Tests=2,  0 wallclock secs ( 0.01 usr  0.01 sys +  0.06 cusr 
> 0.01 csys =  0.09 CPU) Result: PASS
>     $
>
> After that the language implementor can start customizing the grammar,
> actions, etc. for whatever language is being built.
>
> Comments welcomed.  Let me know if/when we want this script added
> to tools/dev/ .

Max Mohun wrote something similar after YAPC::NA this year, but I held off on 
it until NQP was complete.  Here's the most recent tarball he produced.  I 
think it's a bit further along, but it's definitely along the same lines.

-- c

Attachment: make_parrot_compiler.tar.bz2
Description: application/tbz

Reply via email to