Skip to content

Commit

Permalink
Add notes for Ruby Ireland talk on ANTLR.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana Nelson authored and Ana Nelson committed Jun 15, 2010
1 parent 32c3fd5 commit 5e20a96
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 3 deletions.
1 change: 1 addition & 0 deletions .bnsignore
Expand Up @@ -18,6 +18,7 @@ pkg
.bzr
.bzrignore
examples
debug-examples
webby
stats
spec
Expand Down
5 changes: 2 additions & 3 deletions examples/row_height.rb
@@ -1,10 +1,9 @@
require "lib/surpass"
require 'rubygems'
require 'surpass'

book = Workbook.new
sheet = book.add_sheet

sheet.write(0, 0, "surpass #{Surpass::VERSION} running on #{RUBY_DESCRIPTION}")

top_align = StyleFormat.new(:text_align => 'top')
bottom_align = StyleFormat.new(:text_align => 'bottom')

Expand Down
2 changes: 2 additions & 0 deletions lib/surpass/cell.rb
Expand Up @@ -15,6 +15,7 @@ def col
end
end

### @export "string-cell"
class StringCell < Cell
def initialize(parent, index, format_index, sst_index)
@parent = parent
Expand All @@ -27,6 +28,7 @@ def to_biff
LabelSSTRecord.new(@parent.index, @index, @format_index, @sst_index).to_biff
end
end
### @end

class BlankCell < Cell
def initialize(parent, index, format_index)
Expand Down
30 changes: 30 additions & 0 deletions webby/content/talks/ruby-ireland-2010-06-15/antlr-notes.txt
@@ -0,0 +1,30 @@
What is ANTLR?
Parser Generator
ANother Tool for Language Recognition

What would you use it for?
- Domain Specific Languages
- When a regular expression gets too complicated
- When you need really robust code
- Learning more about computer science

vs. Ragel
- Ragel better for state-machine type uses
- ANTLR has recursion - *very* powerful and used in Excel parser
- For many parsing tasks either will work, should try both and see which fits

Targets
- native Ruby: new target
- Java: very well tested, the 'default' target for ANTLR, use via JRuby
- C: For performance/compactness if you don't need JRuby compatibility and you don't mind C
- C# on CLR maybe?

Native Ruby Target
http://ohboyohboyohboy.github.com/antlr3/

Surpass
- Create Excel spreadsheets using just Ruby - no need to have Microsoft Office or Windows
- We write the .xls files directly
- Microsoft file formats are pretty nasty!
- This is why we need a parser!!

15 changes: 15 additions & 0 deletions webby/content/talks/ruby-ireland-2010-06-15/antlr-talk.erb
@@ -0,0 +1,15 @@
---
title: ANTLR for Ruby
subtitle: Excel Formula Generation
author: Ana Nelson
created_at: 2010-06-15
layout: beamer
filter:
- erb
---


\begin{frame}[fragile]
<%= gorgl("../lib/surpass/cell.rb", "string-cell") %>
\end{frame}

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions webby/layouts/beamer.txt
@@ -0,0 +1,32 @@
---
extension: tex
filter: erb
---
\documentclass{beamer}
\usetheme{Boadilla}

\usepackage{fancyvrb}
\usepackage{color}
\usepackage[ascii]{inputenc}
\usepackage{hyperref}
\usepackage{wrapfig}
\usepackage{multicol}

<%= pygments_latex_styles %>


\title{<%= @page.title %>}
\subtitle{<%= @page.subtitle %>}
\author{<%= @page.author %>}
\date[<%= @page.created_at.strftime("%B %Y") %>]{<%= @page.created_at.strftime("%d %b %Y") %>}

\begin{document}

\begin{frame}[plain]
\titlepage
\end{frame}


<%= @content %>

\end{document}

0 comments on commit 5e20a96

Please sign in to comment.