GithubHelp home page GithubHelp logo

andrea-deluca / cli-compdev Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.78 MB

Command Line Interface for Unix-like OS and Windows OS that helps you to start a project for the development of your own compiler.

License: MIT License

Makefile 0.22% Java 96.93% Lex 0.50% Shell 2.35% Batchfile 0.01%
batch-script compilers java-cup jflex macos-terminal parser scanner script shell-script unix-command

cli-compdev's Introduction

CLI-compdev

Command Line Interface for Unix-like OS and Windows OS that helps you to start a project for the development of your own compiler.

Table of Contents

  1. Directory Structure
  2. How to install CLI-compdev
  3. Get started with compdev
  4. Community collaboration
  5. Changelog

Directory Structure

This is the tree chart of the project structure.

|--- /conifg
|    |--- /modules
|    |    |--- /java_cup
|    |    |--- /jflex
|    |
|    |--- /win_makefile
|    |    |--- /Makefile
|    |
|    |--- /Makefile
|    |--- /parser.cup
|    |--- /scanner.jflex
|
|--- /unix
|    |--- /compdev.sh
|
|--- /windows
     |--- /compdev.sh
     |--- /compdev.bat

How to install CLI-compdev

Download CLI-compdev release from here, unzip the getted archive and follow the guide for your OS.

On MacOS

Before starting, you can delete windows and config/win_makefile folders.

1. Setting up config folder

Move config folder wherever you want on you MacOS.

I suggest you to create a new directory, e.g. ~/Documents/compdev, where you can easily put the config folder.

Be sure you remember where you put this directory because you are going to use its path.

2. Setting up compdev.sh file

Open unix folder and edit compdev.sh file. You have to replace config_path constant at the beginning of the file with the path to config folder.

#!/bin/bash

program=compdev
current_dir=.

# path to program config folder
config_path=path/to/config/folder   # Edit this, e.g.
                                    # config_path=~/Documents/compdev/config

[...]

3. Move compdev.sh to the correct location

Open Terminal application, navigate to the folder where you have compdev.sh and move the file into /usr/local/bin system directory with the command below.

sudo mv ./compdev.sh /usr/local/bin/COMPDEV

As /usr/local/bin directory is owned by user root, you must be an admin and use sudo to move files there.

4. Set owner and permissions

The script should be owned by and writable for root, but readable and executable for everyone. The two commands below ensure this:

sudo chown root: /usr/local/bin/COMPDEV
sudo chmod 755 /usr/local/bin/COMPDEV

On Windows

Be sure you have WSL installed on your PC before starting install compdev.

Before starting, you can delete unix folder and config/Makefile file.

1. Setting up config folder

Move config folder wherever you want on your Windows.

I suggest you to create a new directory, e.g. C:\Users\Andrea\Documents\compdev, where you can easily put the config folder.

Be sure you remember where you put this directory because you are going to use its path.

2. Setting up compdev.sh file

Open windows folder and edit compdev.sh file. You have to replace config_path constant at the beginning of the file with the path to config folder.

#!/bin/bash

program=compdev
current_dir=.

# path to program config folder
config_path=path/to/config/folder/in/wsl    # Edit this, e.g.
                                            # config_path=/mnt/c/Users/Andrea/Documents/compdev

[...]

3. Move compdev.sh and compdev.bat to the correct location

Move compdev.sh and compdev.bat files into C:\Windows\System32 folder.

Get started with compdev

You can use compdev to create a project already formatted and possibly templated for the development of your own compiler.

For now, you can use it just with jflex and java_cup, because just their module are loaded into config/module folder and, morover, templated and non-templated initialization is based on them.

The complete list of command at the moment available is shown below.

init

You can use compdev init to initialize your project.

$ compdev init <project_name> [--template]

You should type the name of your new project instead of <project_name>, but you can also type . instead of <project_name> to initialize your project in the current directory where you are running this command.

The default initialization, without --template option, create the following project structure:

|--- /<project_name>
     |--- /build
     |--- /modules
     |--- /source
     |    |--- /scanner.jflex
     |    |--- /parser.cup
     |
     |--- /Makefile

The --template option is not mandatory, but, if you use it, the project is initialized with jflex and java_cup preloaded into modules folder. In addition, scanner.flex, parser.cup and Makefile are templated on the same files you can find within config folder. Here the --template option project structure:

|--- /<project_name>
     |--- /build
     |--- /modules
     |    |--- /java_cup
     |    |--- /jflex
     |
     |--- /source
     |    |--- /scanner.jflex (Templated)
     |    |--- /parser.cup (Templated)
     |
     |--- /Makefile (Templated)

add

If you have already initialized your project, maybe without --template option, and you want to add a module, you can use the compdev add command.

$ compdev add <module_name>

At the moment, just jflex and java_cup are defined as modules and just them are within the config folder. So you can use just their name instead of <module_name>.

help

For info about commands available, you can run compdev help.

$ compdev help

Community collaboration

I would be very happy if you expanded this project.

You can expand and edit compdev with whatever you want. You can add new modules and new templates by means editing source code and you can also suggest optimizations or prettier code.

In addition, I also suggest you to watch issues.

I know this program is not perfect but I think it can be a good starting point, so you are welcome!

Changelog

Here you can check changes between software releases.

v0.0.1

  • Release of compdev for Unix-like OS and Windows.
  • Just jflex and java_cup modules support available.

cli-compdev's People

Contributors

andrea-deluca avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.