Move go target docs

This commit is contained in:
Peter Boyer 2016-11-04 14:36:02 -04:00
parent 48e1f060d7
commit 8b67d2418c
2 changed files with 14 additions and 25 deletions

View File

@ -1,28 +1,3 @@
# ANTLR4 Language Target, Runtime for Go
[![Join the chat at https://gitter.im/pboyer/antlr4](https://badges.gitter.im/pboyer/antlr4.svg)](https://gitter.im/pboyer/antlr4?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/pboyer/antlr4.svg?branch=master)](https://travis-ci.org/pboyer/antlr4)
### Usage
1. `go get github.com/pboyer/antlr4`
2. Get [StringTemplate](http://www.stringtemplate.org/)
3. Get [Maven](https://maven.apache.org/download.cgi)
- Put `mvn` in your PATH (e.g. in `~/.bashrc` add `export PATH=$PATH:/path/to/apache-maven-3.3.9/bin`)
4. From the repo directory, `mvn install` (add `-DskipTests` to skip the tests)
5. Put StringTemplate and ANTLR binaries on your `CLASSPATH`
- `export CLASSPATH=".:/path/to/ST-4.0.8.jar:$CLASSPATH"`
- `export CLASSPATH=".:$GOPATH/src/github.com/pboyer/antlr4/tool/target/antlr4-4.5.2-SNAPSHOT.jar:$CLASSPATH"`
5. (Optional) Add an alias for calling antlr
- `alias antlr='java -jar $GOPATH/src/github.com/pboyer/antlr4/tool/target/antlr4-4.5.2-SNAPSHOT.jar'`
6. Now, `antlr Grammar.g4 -Dlanguage=Go`
---
_From the ANTLR README_
# ANTLR v4
**ANTLR** (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR generates a parser that can build parse trees and also generates a listener interface (or visitor) that makes it easy to respond to the recognition of phrases of interest.

14
doc/go-target.md Normal file
View File

@ -0,0 +1,14 @@
# ANTLR4 Language Target, Runtime for Go
### Getting started
1. Get the runtime and install it on your GOPATH: `go get github.com/antlr/antlr4`
2. Generate the parser/lexer code: `antlr MyGrammar.g4 -Dlanguage=Go`
### Referencing in your code
Reference the go package like this:
```go
import "github.com/pboyer/antlr4/runtime/Go/antlr"
```