Skip to content

djspiewak/scala-bison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScalaBison -- Generate LAXLC(1) parsers in Scala from bison input and output files.

Release Notes
Version 1.1, September 2018

Please see LICENSE for software licensing.


(1) Downloading

You need the script scala-bison and library scala-bison-$VERSION.jar
from the release area.  The former (but not the latter) is also available
in the source tree in the cmd/ directory.  
$VERSION is the Scala version (2.9, 2.10 or 2.11)

You must also have bison installed.  ScalaBison uses it.

(2) Installation

  There is no automatic installation.  Minimally you need:
      SCALABISONDIR/X/scala-bison
      SCALABISONDIR/lib/scala-bison-$VERSION.jar
  where SCALABISONDIR is a path such as "/usr/local", and "X" is "cmd" or "bin" or the like.

  The scala-bison script assumes "bison" is in the default path.
  
(3) Using ScalaBison

  In lieu of documentation: here's the basic way to use ScalaBison

  (a) Create a bison-style xxx.y file.  
      Unlike bison, ScalaBison requires every grammar production
      to end with a semicolon.  (Semicolons are optional in bison).

  (b) run scala-bison xxx.y to create two files: XXXParser.scala and XXXTokens.scala
  
  (c) Move these files into the correct Scala package and then compile with the Scala compiler.
      (ScalaBison generated parsers do not need or use the scala-bison.jar.)

Interested in a Scanner generator for Scala too?
See https://github.com/moy/JFlex/tree/1.5+scala

-----------------------------------------------------------------------------------------------

(4) Compiling ScalaBison from source

  ScalaBison is bootstrapped through itself.  Thus you need
  scalabison.jar before you can build ScalaBison, and thus create
  the JAR file.

  You can use one of the released scala-bison-$VERSION files, but 
  will need to put it in the root directory of the source and name it "scala-bison.jar"

  Then using "make"
	make boot
	make compile
	make
  This will create your own scala-bison.jar file (deleting the old one
  in the process).  Then you should repeat the bootstrapping process:
	make boot
	make compile
	make
  Now you have a scala-bison generated and compiled by itself.