Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First draft of tools, READMEs, 00-preface, etc.

  • Loading branch information...
commit e914c6fbaef012d60bc5f9bf9f542623a0a192aa 1 parent 484c040
@pmichaud pmichaud authored
View
1  .gitignore
@@ -0,0 +1 @@
+nqpbook.*
View
30 Makefile
@@ -0,0 +1,30 @@
+CHAPTERS =src/00-preface.pod
+
+# If you're on a Mac, and installed Inkscape via MacPorts, you might want to
+# manually uncomment the next line, and remove the one after it.
+#INKSCAPE = /Applications/Inkscape.app/Contents/Resources/bin/inkscape
+INKSCAPE = inkscape
+
+default: build/nqpbook.pdf
+
+release: build/book.pdf
+ cp build/nqpbook.pdf build/nqpbook-$$(date +"%Y-%m").pdf
+
+#build/mmd-table.pdf: src/mmd-table.svg
+# $(INKSCAPE) --export-pdf=build/mmd-table.pdf -D src/mmd-table.svg
+
+build/nqpbook.html: $(CHAPTERS) bin/book-to-html
+ perl bin/book-to-html $(CHAPTERS) > build/nqpbook.html
+
+build/nqpbook.pdf: build/nqpbook.tex
+ cd build && pdflatex nqpbook.tex && pdflatex nqpbook.tex
+
+build/nqpbook.tex: $(CHAPTERS) bin/book-to-latex
+ perl bin/book-to-latex $(CHAPTERS) > build/nqpbook.tex
+
+clean:
+ rm -rf build/*
+
+.PHONY: clean
+
+# vim: set noexpandtab
View
31 README
@@ -0,0 +1,31 @@
+This is a book about creating compilers using NQP.
+
+It is intended to be something of a tutorial -- walking the reader
+through the stages of building a simple compiler and incrementally
+adding features to get a full-fledged language.
+
+Currently the primary author is Patrick Michaud, but anyone who
+is willing to work on the book is welcome to join the effort.
+We tend to hang out on #parrot on irc.parrot.org and #perl6 on
+irc.freenode.net .
+
+To build the book, you need to have the following software installed:
+
+ * make
+ * perl 5
+ * the Perl 5 module Pod::PseudoPod::LaTeX
+ * inkscape (for svg -> pdf conversion)
+ * pdflatex
+
+Just type 'make' on your command line, and the book should be built in
+build/nqpbook.pdf .
+
+(Hint for Kubuntu 9.10: In order to get the above modules, I did
+ cpan Pod::PseudoPod::LaTeX
+ apt-get install inkscape texlive-latex-base
+)
+
+All material in this repository is licensed under a CC-by-nc-sa license:
+<http://creativecommons.org/licenses/by-nc-sa/2.5/> (attribution,
+noncommercial, share-alike), unless explicitly stated otherwise.
+(Maybe we'll remove the noncommercial part at some point.)
View
10 authors.pod
@@ -0,0 +1,10 @@
+=head1 Authors
+
+This book is the work of many contributors. They are listed below.
+
+=item Patrick R. Michaud
+
+Patrick is the chief architect of NQP and of Rakudo, the Parrot-based
+Perl 6 compiler.
+
+
View
26 bin/ascii-to-pod.pl
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use 5.010;
+use utf8;
+use open IO => ':encoding(utf8)';;
+
+use Data::Dumper;
+$Data::Dumper::Useqq = 1;
+
+say "=begin table\n";
+while (<>) {
+ chomp;
+ s/^\s+//;
+ next unless length $_;
+ my @row = split /\s{2,}/, $_;
+ say "=headrow\n" if $. == 1;
+
+ say "=row\n";
+
+ for my $c (@row) {
+ say "=cell $c\n";
+ }
+
+ say "=bodyrows\n" if $. == 1;
+}
+say "=end table";
View
9 bin/book-to-html
@@ -0,0 +1,9 @@
+#!perl -w
+use strict;
+use Pod::PseudoPod::HTML;
+
+for (@ARGV) {
+ my $parser = Pod::PseudoPod::HTML->new();
+ $parser->output_fh( *STDOUT );
+ $parser->parse_file( $_ );
+}
View
21 bin/book-to-latex
@@ -0,0 +1,21 @@
+#!perl -w
+use strict;
+use Pod::PseudoPod::LaTeX;
+
+print <<'HEADER';
+\documentclass[11pt,a4paper,oneside]{report}
+\usepackage{graphics,graphicx}
+\usepackage{colortbl}
+
+\begin{document}
+HEADER
+
+for (@ARGV) {
+ my $parser = Pod::PseudoPod::LaTeX->new();
+ $parser->output_fh( *STDOUT );
+ $parser->parse_file( $_ );
+}
+
+print <<'FOOTER';
+\end{document}
+FOOTER
View
1  build/.gitignore
@@ -0,0 +1 @@
+*
View
35 src/00-preface.pod
@@ -0,0 +1,35 @@
+=head0 Preface
+
+NQP is short for "Not Quite Perl" -- a lightweight Perl6-like
+language for targetting virtual machines such as Parrot. The
+key feature of NQP is that it's designed to be a small compiler
+with minimal runtime libraries (as compared to Perl 6, which has
+a very large CORE library). NQP's primary goal is to provide
+a high-level language for writing compilers and libraries.
+
+This book is an introduction to using NQP to create compilers.
+Since NQP's primary target is Parrot, this book focuses on
+compiler creation in Parrot (although other backends for NQP
+are envisioned).
+
+The book is a work-in-progress, and it's expected that there
+will be sections of C<TODO> comments sprinkled throughout the
+text, to serve as reminders of things to be added, clarified,
+or otherwise addressed as we continually improve the text.
+
+=head1 Audience
+
+This book is primarily for people who want to learn about NQP
+and have some experience programming in other programming
+languages.
+
+=head1 Obtaining and installing NQP
+
+A version of NQP comes compiled and installed with Parrot; we
+recommend using that.
+
+=head1 Getting involved in NQP, Parrot, or the book
+
+TODO: Add this section.
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.