Make a language! (JavaCC environment construction)

There was a tool called JavaCC (Java Compiler Compiler) that can be used with Java.

What is JavaCC

A tool for parsing (recursive descent) and lexical analysis. If you write your own parsing and lexical analysis definition files, a Java parser will be generated for you.

JavaCC development environment

Eclipse is used as a comprehensive development environment. A JavaCC plugin for Eclipse (a set for each compiler) is provided. Please install the plug-in by specifying the following from "help"-> "install new software". JavaCC - http://eclipse-javacc.sourceforge.net/

image.png

JavaCC project creation

Create a new Java Project of your choice. image.png

Create a new template file. image.png

Select jjt and the package completes by default image.png

Replace <? Parser_name?> With MyNewPerser all at once. image.png

image.png

When saved, the parser is automatically generated as shown below. image.png

If it is not automatically generated, right-click the jjt file and execute "Compile with javacc".

Run

Since main is attached to the MyNewParser class, it can be executed as it is.

image.png (Displays a simple formula syntax tree)

next time

Make a language! (Making a simple calculator ①) followed by.

Recommended Posts

Make a language! (JavaCC environment construction)
Make a language! (Making a simple calculator ②)
Make a language! (Making a simple calculator ①)
Coding 10 lines a day ~ Scraping environment construction ~
[Java] Environment construction
Java environment construction
[Spring] Environment construction
Docker environment construction
[Notepad ++] C language / Java compilation & execution environment construction
A reminder of Docker and development environment construction
Penronse environment construction [Windows]
[Environment construction] Eclipse installation
[Flutter] Ubuntu 20.04 environment construction
Rails Docker environment construction
Make a reflection utility ②
Make a reflection utility ③
Circle CI environment construction
java development environment construction
Make a reflection utility ①
[Environment construction] Build a Java development environment with VS Code!
Create a Java and JavaScript team development environment (gradle environment construction)
Rails6 development environment construction [Mac]
[Spring Boot] Environment construction (macOS)
Rails engineer environment construction ruby2.7.1
EC-CUBE4 environment construction (local edition)
I tried node-jt400 (Environment construction)
Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
MySQL 5.7 (Docker) environment construction memo
Introduction to Metabase ~ Environment Construction ~
[Java] Make it a constant
JavaFX environment construction in Java 13
Redmine (Docker) environment construction memo
[Docker] Rails 5.2 environment construction with docker
AtCoder Challenge Environment Construction (Java 8)
Offline environment construction Ruby edition
Docker × Spring Boot environment construction
[Rails] Make a breadcrumb trail
[Super easy] Ruby environment construction
[Rails / MySQL] Mac environment construction
Ruby ① Build a Windows environment
[Docker] postgres, pgadmin4 environment construction
Laravel environment construction (Ubuntu 18.04 LTS)
React environment construction with Docker
Make a rhombus using Java
Offline environment construction CentOS edition
[Introduction] Build a virtual environment of Vagrant + VirtualBox on Window10 [Environment construction]
I tried to make a machine learning application with Dash (+ Docker) part1 ~ Environment construction and operation check ~