Permalink
Browse files

Tweaks to the README as well as bumping some of the project.clj to us…

…e the new lein2.
  • Loading branch information...
1 parent f5720be commit 1e5bf805a812ea4a27b55ad45658092d79defaca @richard-lyman committed Jul 28, 2012
Showing with 33 additions and 9 deletions.
  1. +2 −0 .gitignore
  2. +28 −6 README.markdown
  3. +3 −3 project.clj
View
@@ -1,2 +1,4 @@
lib
.lein*
+pom.xml
+target
View
@@ -9,6 +9,7 @@
<h2>Table of Contents</h2>
+* Quick Use
* Basic Definitions
* Name and Pronunciation
* Introduction to Reading Grammars (or, Don't Be Afraid)
@@ -19,6 +20,27 @@
* Amotoen Grammar Definition
* Recent Improvements
+<h2>Quick Use</h2>
+ 1. `lein new something`
+ 2. `cd something`
+ 3. Add the Clojars dependency to the new project.clj file (`[com.lithinos/amotoen "0.2.0-SNAPSHOT"]`)
+ - Your dependencies section would then look like this: `:dependencies [[org.clojure/clojure "1.4.0"] [com.lithinos/amotoen "0.2.0-SNAPSHOT"]]`
+ 4. Modify `test/something/core_test.clj` so that it looks like this:
+```
+(ns something.core-test
+ (:use clojure.test
+ something.core
+ clojure.pprint ; Amotoen doesn't require this, just the sample code below
+ com.lithinos.amotoen.grammars.csv))
+
+(deftest use-amotoen
+ (pprint (to-clj "a,b,c")))
+```
+ 5. Run `lein test`
+ - You should see: `[["a" "b" "c"]]`
+ 6. Create your program as normal in the src folder
+
+
<h2>Basic Definitions</h2>
There are several words used in this README that might be made clearer for the beginner through short simple definitions.
@@ -57,8 +79,8 @@ Lists that have an 'a' as the first element will contain an 'Aware Function'.
Lists that have an 'f' as the first element will contain a simpler 'Function'.
There are also special pre-provided keywords.
-Use of the keyword ```:$``` means that the input should be at the end at that point.
-Use of the keyword ```:.``` means that any character is accepted at that point.
+Use of the keyword `:$` means that the input should be at the end at that point.
+Use of the keyword `:.` means that any character is accepted at that point.
<h2>Introduction to Reading Grammars (or, Don't Be Afraid)</h2>
@@ -100,13 +122,13 @@ You should now be able to read the three rules that work with whitespace, the :W
Using a grammar like the CSV one above can produce one of two types of outputs.
The more common output would be for a provider of a grammar to process the intermediate format and produce some kind of more relevant one,
-The package com.lithinos.amotoen.grammars.csv provides a ```to-clj``` function that produces a Clojure data structure representing the CSV file.
-An example of this format using the ```to-clj``` function and an input of just ```a,b,c\nx,y,z``` is as follows:
+The package com.lithinos.amotoen.grammars.csv provides a `to-clj` function that produces a Clojure data structure representing the CSV file.
+An example of this format using the `to-clj` function and an input of just `a,b,c\nx,y,z` is as follows:
```[["a" "b" "c"] ["x" "y" "z"]]```
The less common output is an AST, or Abstract Syntax Tree.
You **shouldn't have to care about this first kind of output** unless you want to, since it's meant as an intermediate format.
-An example of this format using the CSV grammar and an input of just ```a``` is as follows:
+An example of this format using the CSV grammar and an input of just `a` is as follows:
```
{
:Document [
@@ -130,7 +152,7 @@ One way is to call the Amotoen function 'pegasus' and provide three arguments.
The first argument to pegasus is the key for the root rule in the grammar, the rule that should be run first.
The second argument is the grammar definition.
The third argument is something that fulfils the IAmotoen protocol, and the provided 'wrap-string' function will do just that for Strings.
-Putting all these pieces together with the input from above of ```a``` you get:
+Putting all these pieces together with the input from above of `a` you get:
```(pegasus :Document grammar (wrap-string "a"))```
Much more information can be found in the tests for CSV, the com.lithinos.amotoen.test.csv package.
View
@@ -3,8 +3,8 @@
:url "http://www.lithinos.com/amotoen"
:license {:name "EPL-v1.0" :distribution :repo :comments "same as Clojure" :url "http://www.eclipse.org/legal/epl-v10.html"}
:source-path "src"
- :resources-path "res"
- :dependencies [[org.clojure/clojure "1.3.0"]]
+ :resource-paths ["res"]
+ :dependencies [[org.clojure/clojure "1.4.0"]]
:jar-name "amotoen.jar"
- :jar-exclusions [#"(markdown|minimark|csv|json|project).clj" #"maven"]
+ :jar-exclusions [#"(markdown|minimark|project).clj" #"maven"]
:manifest {"Built-By" "\"Richard Lyman\" <richard.lyman@gmail.com>"})

0 comments on commit 1e5bf80

Please sign in to comment.