JavaCC setup procedure

Very easy setup procedure

I really wanted to parse it at work, so I had the opportunity to use a parser generator called JavaCC. This article is a procedure for myself that I read and summarized various things such as Getting Started on the official page when using JavaCC.

  1. Environment We have confirmed the operation in the following environment.

    OS JDK JavaCC
    Redhat Enterprise Linux(RHEL) 6 1.6 6.0
    macOS Mojave 1.8 6.0
    Windows 10 1.8 6.0
  2. Reference Official page: Getting Started

  3. Download Download the zip file from the Official Download Site. In my environment, I pressed the link button "Download JavaCC 6.0" and the download started.

  4. Unzip Unzip the downloaded zip file You can unzip it anywhere you have write permission. (I unzipped it under my home directory as follows so as not to damage the environment on the server side.)

    ${HOME}/usr/local/tools/javacc-6.0
    
    %systemdrive%%homepath%¥usr¥local¥tools¥javacc-6.0
    
  5. Creating an executable file There is a directory called "bin" in the unzipped directory (folder). The following executable file will be generated here.

    #!/bin/bash
    java -cp ${HOME}/usr/local/tools/javacc-6.0/bin/lib/javacc.jar javacc "$@"
    
    @ECHO OFF
    java -cp %systemdrive%%homepath%¥usr¥local¥tools¥javacc-6.0¥bin¥lib¥javacc.jar javacc %%*
    
  6. Pass through the path. Add the directory where the executable file is placed to the user environment variable PATH.

    export PATH=${PATH}:${HOME}/usr/local/tools/javacc-6.0/bin
    
    set PATH=%PATH%;%systemdrive%%homepath%¥usr¥local¥tools¥javacc-6.0¥bin
    
  7. Let's test Setup is complete above. Now let's test if it works. (Omitted for Windows)

Linux/Mac(Home directory/home/When hogehoge)


  > #First, check that the PATH has passed
  > which javacc
  /home/hogehoge/usr/local/tools/javacc-6.0/bin/javacc
  > #Confirm that javacc can be executed
  > javacc
  Java Compiler Compiler Version 6.0_1 (Parser Generator)

  Usage:
      javacc option-settings inputfile

  "option-settings" is a sequence of settings separated by spaces.
  Each option setting must be of one of the following forms:

    ...(In reality, you will get a longer message.)

Recommended Posts

JavaCC setup procedure
Keycloak setup
RSpec setup
RSpec Setup
Devise procedure