Skip to content

Commit

Permalink
Merge pull request #1602 from ruby/rename
Browse files Browse the repository at this point in the history
Rename YARP to prism
  • Loading branch information
kddnewton committed Sep 27, 2023
2 parents 3bfefc4 + ad33501 commit 89cd68f
Show file tree
Hide file tree
Showing 2,010 changed files with 9,372 additions and 9,368 deletions.
8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ templates/**/*.h.erb linguist-language=C
templates/**/*.java.erb linguist-language=Java
templates/**/*.rb.erb linguist-language=Ruby

test/yarp/fixtures/seattlerb/**/*.txt linguist-vendored
test/yarp/fixtures/unparser/**/*.txt linguist-vendored
test/yarp/fixtures/whitequark/**/*.txt linguist-vendored
test/yarp/snapshots/**/*.txt linguist-generated
test/prism/fixtures/seattlerb/**/*.txt linguist-vendored
test/prism/fixtures/unparser/**/*.txt linguist-vendored
test/prism/fixtures/whitequark/**/*.txt linguist-vendored
test/prism/snapshots/**/*.txt linguist-generated

# All .rb files should have LF line ending, even on Windows, regardless of the git config core.autocrlf value.
# All .txt should have their line endings as committed in the repository (there are some intentional CR in there),
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:

jobs:
build:
if: github.repository == 'ruby/yarp'
if: github.repository == 'ruby/prism'
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ jobs:
ruby: [ruby, jruby, truffleruby]
runs-on: ubuntu-latest
env:
YARP_FFI_BACKEND: "true"
PRISM_FFI_BACKEND: "true"
steps:
- uses: actions/checkout@v3
# The Gemfile.lock is different with YARP_FFI_BACKEND=true for CRuby
# The Gemfile.lock is different with PRISM_FFI_BACKEND=true for CRuby
- run: rm Gemfile.lock
if: matrix.ruby == 'ruby'
- name: Set up Ruby
Expand All @@ -92,7 +92,7 @@ jobs:
- name: Run Ruby tests
run: bundle exec rake
env:
YARP_DEBUG_MODE_BUILD: "1"
PRISM_DEBUG_MODE_BUILD: "1"

build-without-assertions:
strategy:
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
ruby-version: jruby
bundler-cache: true
- name: Run Java Loader test
run: YARP_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 JRUBY_OPTS="-J-ea" bundle exec rake test:java_loader
run: PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 JRUBY_OPTS="-J-ea" bundle exec rake test:java_loader

lex-ruby:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
- name: Serialized size stats with all fields
run: bundle exec rake serialized_size:topgems
- name: Recompile with only semantic fields
run: YARP_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 bundle exec rake clobber compile
run: PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 bundle exec rake clobber compile
- name: Serialized size stats with only semantic fields
run: bundle exec rake serialized_size:topgems

Expand Down Expand Up @@ -236,8 +236,8 @@ jobs:
name: gem-package
path: pkg
- run: |
gem install --local pkg/yarp-*.gem
gem list -d yarp
gem install --local pkg/prism-*.gem
gem list -d prism
shell: bash
- name: Run tests
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
crate: [yarp-sys, yarp]
crate: [prism-sys, prism]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
strategy:
fail-fast: false
matrix:
crate: [yarp-sys, yarp]
crate: [prism-sys, prism]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
fail-fast: false
matrix:
sanitizer: [address, leak]
crate: [yarp-sys, yarp]
crate: [prism-sys, prism]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/truffleruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ on:
jobs:
# Inspired from https://github.com/oracle/truffleruby/blob/master/.github/workflows/ci.yml
test-loader:
if: github.repository == 'ruby/yarp'
if: github.repository == 'ruby/prism'
runs-on: ubuntu-20.04 # to be consistent with that workflow and test on older platform
steps:
- name: Clone YARP
- name: Clone prism
uses: actions/checkout@v3
with:
path: yarp
path: prism
- name: Setup system Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
bundler-cache: true
working-directory: yarp
working-directory: prism

- run: mkdir truffleruby-ws
- name: Clone TruffleRuby
Expand All @@ -41,8 +41,8 @@ jobs:
path: ~/.mx/cache
key: mx-cache-${{ runner.os }}

- name: Import latest YARP in TruffleRuby
run: tool/import-yarp.sh
- name: Import latest prism in TruffleRuby
run: tool/import-prism.sh
working-directory: truffleruby-ws/truffleruby

- name: Install JVMCI
Expand All @@ -66,13 +66,13 @@ jobs:
run: jt build -- --dependencies "$(jt -q mx --env jvm graalvm-dist-name)"
working-directory: truffleruby-ws/truffleruby

- name: Parse test/yarp/fixtures/**/*.rb
run: jt ruby -e 'Dir.glob("test/yarp/fixtures/**/*.rb") { |file| puts file; Truffle::Debug.yarp_parse(File.read(file)) }'
working-directory: yarp
- name: Parse test/prism/fixtures/**/*.rb
run: jt ruby -e 'Dir.glob("test/prism/fixtures/**/*.rb") { |file| puts file; Truffle::Debug.prism_parse(File.read(file)) }'
working-directory: prism

- name: Parse src/main/ruby/truffleruby/**/*.rb
run: jt ruby -e 'Dir.glob("src/main/ruby/truffleruby/**/*.rb") { |file| puts file; Truffle::Debug.yarp_parse(File.read(file)) }'
run: jt ruby -e 'Dir.glob("src/main/ruby/truffleruby/**/*.rb") { |file| puts file; Truffle::Debug.prism_parse(File.read(file)) }'
working-directory: truffleruby-ws/truffleruby

- name: Execute p 1+2
run: jt ruby -e 'Truffle::Debug.yarp_execute "p 1+2"'
run: jt ruby -e 'Truffle::Debug.prism_execute "p 1+2"'
30 changes: 15 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
/vendor/bundle

/build/
/lib/yarp/yarp.*
/lib/yarp.bundle
/lib/yarp.so
/lib/prism/prism.*
/lib/prism.bundle
/lib/prism.so
/test.rb
*.dSYM
/*.iml
Expand All @@ -22,19 +22,19 @@
test.c
a.out

/ext/yarp/api_node.c
/ext/prism/api_node.c
/fuzz/output/
/include/yarp/ast.h
/java/org/yarp/AbstractNodeVisitor.java
/java/org/yarp/Loader.java
/java/org/yarp/Nodes.java
/lib/yarp/compiler.rb
/lib/yarp/dispatcher.rb
/lib/yarp/dsl.rb
/lib/yarp/mutation_compiler.rb
/lib/yarp/node.rb
/lib/yarp/serialize.rb
/lib/yarp/visitor.rb
/include/prism/ast.h
/java/org/prism/AbstractNodeVisitor.java
/java/org/prism/Loader.java
/java/org/prism/Nodes.java
/lib/prism/compiler.rb
/lib/prism/dispatcher.rb
/lib/prism/dsl.rb
/lib/prism/mutation_compiler.rb
/lib/prism/node.rb
/lib/prism/serialize.rb
/lib/prism/visitor.rb
/src/node.c
/src/prettyprint.c
/src/serialize.c
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Thank you for your interest in contributing to YARP! Below are a couple of ways that you can help out.
Thank you for your interest in contributing to prism! Below are a couple of ways that you can help out.

## Discussions

Expand Down Expand Up @@ -29,7 +29,7 @@ or explicitly running the `compile` task:
``` sh
bundle exec rake compile test
# or to just compile the C extension ...
bundle exec rake compile:yarp test
bundle exec rake compile:prism test
```

To test the rust bindings (with caveats about setting up your Rust environment properly first):
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
yarp (0.12.0)
prism (0.12.0)

GEM
remote: https://rubygems.org/
Expand All @@ -28,11 +28,11 @@ PLATFORMS

DEPENDENCIES
ffi
prism!
rake
rake-compiler
ruby_memcheck
test-unit
yarp!

BUNDLED WITH
2.3.6
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ build/librubyparser.a: $(STATIC_OBJECTS)
build/shared/%.o: src/%.c Makefile $(HEADERS)
$(ECHO) "compiling $@"
$(Q) mkdir -p $(@D)
$(Q) $(CC) $(DEBUG_FLAGS) -DYP_EXPORT_SYMBOLS $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
$(Q) $(CC) $(DEBUG_FLAGS) -DPRISM_EXPORT_SYMBOLS $(CPPFLAGS) $(CFLAGS) -c -o $@ $<

build/static/%.o: src/%.c Makefile $(HEADERS)
$(ECHO) "compiling $@"
Expand All @@ -55,20 +55,20 @@ build/fuzz.heisenbug.%: $(SOURCES) fuzz/%.c fuzz/heisenbug.c

fuzz-debug:
$(ECHO) "entering debug shell"
$(Q) docker run -it --rm -e HISTFILE=/yarp/fuzz/output/.bash_history -v $(shell pwd):/yarp -v $(FUZZ_OUTPUT_DIR):/fuzz_output yarp/fuzz
$(Q) docker run -it --rm -e HISTFILE=/prism/fuzz/output/.bash_history -v $(shell pwd):/prism -v $(FUZZ_OUTPUT_DIR):/fuzz_output prism/fuzz

fuzz-docker-build: fuzz/docker/Dockerfile
$(ECHO) "building docker image"
$(Q) docker build -t yarp/fuzz fuzz/docker/
$(Q) docker build -t prism/fuzz fuzz/docker/

fuzz-run-%: FORCE fuzz-docker-build
$(ECHO) "generating templates"
$(Q) bundle exec rake templates
$(ECHO) "running $* fuzzer"
$(Q) docker run --rm -v $(shell pwd):/yarp yarp/fuzz /bin/bash -c "FUZZ_FLAGS=\"$(FUZZ_FLAGS)\" make build/fuzz.$*"
$(Q) docker run --rm -v $(shell pwd):/prism prism/fuzz /bin/bash -c "FUZZ_FLAGS=\"$(FUZZ_FLAGS)\" make build/fuzz.$*"
$(ECHO) "starting AFL++ run"
$(Q) mkdir -p $(FUZZ_OUTPUT_DIR)/$*
$(Q) docker run -it --rm -v $(shell pwd):/yarp -v $(FUZZ_OUTPUT_DIR):/fuzz_output yarp/fuzz /bin/bash -c "./fuzz/$*.sh /fuzz_output/$*"
$(Q) docker run -it --rm -v $(shell pwd):/prism -v $(FUZZ_OUTPUT_DIR):/fuzz_output prism/fuzz /bin/bash -c "./fuzz/$*.sh /fuzz_output/$*"
FORCE:

fuzz-clean:
Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Yet Another Ruby Parser
# Prism Ruby parser

This is a parser for the Ruby programming language. It is designed to be portable, error tolerant, and maintainable. It is written in C99 and has no dependencies. It is currently being integrated into [CRuby](https://github.com/ruby/ruby), [JRuby](https://github.com/jruby/jruby), [TruffleRuby](https://github.com/oracle/truffleruby), [Sorbet](https://github.com/sorbet/sorbet), and [Syntax Tree](https://github.com/ruby-syntax-tree/syntax_tree).

Expand All @@ -16,29 +16,29 @@ The repository contains the infrastructure for both a shared library (librubypar
├── config.yml specification for tokens and nodes in the tree
├── docs documentation about the project
├── ext
│   └── yarp
│   └── prism
│   ├── extconf.rb configuration to generate the Makefile for the native extension
│   └── extension.c the native extension that interacts with librubyparser
├── fuzz files related to fuzz testing
├── include
│   ├── yarp header files for the shared library
│   └── yarp.h main header file for the shared library
│   ├── prism header files for the shared library
│   └── prism.h main header file for the shared library
├── java Java bindings for the shared library
├── lib
│   ├── yarp Ruby library files
│   └── yarp.rb main entrypoint for the Ruby library
│   ├── prism Ruby library files
│   └── prism.rb main entrypoint for the Ruby library
├── rakelib various Rake tasks for the project
├── rust
│   ├── yarp Rustified crate for the shared library
│   └── yarp-sys FFI binding for Rust
│   ├── prism Rustified crate for the shared library
│   └── prism-sys FFI binding for Rust
├── src
│   ├── enc various encoding files
│   ├── util various utility files
│   └── yarp.c main entrypoint for the shared library
│   └── prism.c main entrypoint for the shared library
├── templates contains ERB templates generated by templates/template.rb
│   └── template.rb generates code from the nodes and tokens configured by config.yml
└── test
└── yarp
└── prism
├── fixtures Ruby code used for testing
└── snapshots snapshots of generated syntax trees corresponding to fixtures
```
Expand All @@ -48,7 +48,7 @@ The repository contains the infrastructure for both a shared library (librubypar
To compile the shared library, you will need:

* A C99 compiler
* autotools autoconf, automake, libtool)
* autotools (autoconf, automake, libtool)
* make
* Ruby 3.3.0-preview1 or later

Expand Down Expand Up @@ -87,4 +87,3 @@ See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. We additio
* [Ruby API](docs/ruby_api.md)
* [Serialization](docs/serialization.md)
* [Testing](docs/testing.md)

26 changes: 13 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ task default: [:check_manifest, :compile, :test]
require_relative "templates/template"

desc "Generate all ERB template based files"
task templates: YARP::TEMPLATES
task templates: Prism::TEMPLATES

def windows?
RUBY_PLATFORM.include?("mingw")
Expand All @@ -35,37 +35,37 @@ end
task build: [:templates, :check_manifest]

# the C extension
task "compile:yarp" => ["templates"] # must be before the ExtensionTask is created
task "compile:prism" => ["templates"] # must be before the ExtensionTask is created

if RUBY_ENGINE == "ruby" and !ENV["YARP_FFI_BACKEND"]
if RUBY_ENGINE == "ruby" and !ENV["PRISM_FFI_BACKEND"]
Rake::ExtensionTask.new(:compile) do |ext|
ext.name = "yarp"
ext.ext_dir = "ext/yarp"
ext.lib_dir = "lib/yarp"
ext.gem_spec = Gem::Specification.load("yarp.gemspec")
ext.name = "prism"
ext.ext_dir = "ext/prism"
ext.lib_dir = "lib/prism"
ext.gem_spec = Gem::Specification.load("prism.gemspec")
end
elsif RUBY_ENGINE == "jruby"
require 'rake/javaextensiontask'

# This compiles java to make sure any templating changes produces valid code.
Rake::JavaExtensionTask.new(:compile) do |ext|
ext.name = "yarp"
ext.name = "prism"
ext.ext_dir = "java"
ext.lib_dir = "tmp"
ext.source_version = "1.8"
ext.target_version = "1.8"
ext.gem_spec = Gem::Specification.load("yarp.gemspec")
ext.gem_spec = Gem::Specification.load("prism.gemspec")
end
end

# So `rake clobber` will delete generated files
CLOBBER.concat(YARP::TEMPLATES)
CLOBBER.concat(Prism::TEMPLATES)
CLOBBER.concat(["build"])
CLOBBER << "lib/yarp/yarp.#{RbConfig::CONFIG["DLEXT"]}"
CLOBBER << "lib/prism/prism.#{RbConfig::CONFIG["DLEXT"]}"

YARP::TEMPLATES.each do |filepath|
Prism::TEMPLATES.each do |filepath|
desc "Generate #{filepath}"
file filepath => ["templates/#{filepath}.erb", "templates/template.rb", "config.yml"] do |t|
YARP.template(t.name)
Prism.template(t.name)
end
end

0 comments on commit 89cd68f

Please sign in to comment.