grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

Restructured the repository.

Open KOLANICH opened this issue 3 years ago • 1 comments

Fixes: #2826

KOLANICH avatar Sep 17 '22 22:09 KOLANICH

As I expected, the first thing I had to do was create a Bash function to cd around because I'm totally lost otherwise.

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4
$ mycd() { pushd .; d=`find . -name "$1" -type d`; cd "$d"; }

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4
$ mycd abb
~/proposal/grammars-v4 ~/proposal/grammars-v4

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4/embedded/abb
$ ls
abbLexer.g4  abbParser.g4  examples/  pom.xml  readme.txt

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4/embedded/abb
$ popd
~/proposal/grammars-v4

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4
$ mycd cpp
~/proposal/grammars-v4 ~/proposal/grammars-v4

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4/programming/mainstream/cpp
$ ls
CPP14Lexer.g4  CPP14Parser.g4  examples/  pom.xml

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4/programming/mainstream/cpp
$ popd
~/proposal/grammars-v4

Kenne@DESKTOP-DL44R7B MINGW64 ~/proposal/grammars-v4
$

It works okay for most things, but not everything. For example, there are many directories named "java" (some of which are incorrectly named in lowercase before this PR). An alternative is to grep through all pom.xml for grammar names.

$ cat find-grammar.sh
#!/usr/bin/bash
where=`dirname -- "$0"`
cd "$where"
poms=`find . -name pom.xml | grep -v Generated | grep -v target | grep -v .ignore`
grep -i -E "<grammarName>.*"$1".*</grammarName>" $poms

So, as expected, we going to need a script to navigate around this new structure, which takes the grammar name, or something else. For sure, people are also going to need an index.html or readme.md to find the grammars for "C++", "java", or what have you. If this is added, then the reorg could work out fine.

The build doesn't work because Maven uses the pom.xml to recursively descend the directory structure, which has now changed. Honestly, I think it's rather brain-dead that the pom's have to describe a separate tree structure on top of a file system--Maven should just search down a file system recursively looking for pom.xml.

Note: a more computer science-oriented classification is here. Note that many languages have multiple classifications.

kaby76 avatar Sep 17 '22 23:09 kaby76

@KOLANICH do we still need this PR?

teverett avatar Dec 29 '22 22:12 teverett

I have created it to make the navigation and selection (the purpose of a grammar says something about its complexity, for example identifiers are likely to be simpler than a mainstream programming language) easier. IDK if the projects maintainers do still need the changes proposed here

KOLANICH avatar Dec 29 '22 23:12 KOLANICH

@KOLANICH thanks for this. I'll close it for now.

teverett avatar Jan 02 '23 21:01 teverett