00:00:10.280
okay let's start my talk thank you for
00:00:12.320
joining my session are we be uh talking
00:00:15.920
about how does makes the Ruby grar
00:00:24.720
Go is is the pronunciation is
00:00:28.240
correct okay I ra Engish from here uh
00:00:32.439
I'm so happy to be talking uh uh talking
00:00:35.600
at such an amazing rubby conference like
00:00:38.399
Euro 2024 uh it's an honor to talk at
00:00:43.239
such a great conference and so this is
00:00:46.320
my first time visiting this country
00:00:48.480
Bosnia and Bosnia is such wonderful
00:00:50.600
place uh this food is tasty and it's
00:00:54.000
incredbly com comfortable and enjoyable
00:00:57.079
to spend time here and I love lby and
00:01:00.440
beer so uh I love Bosnia as well because
00:01:04.479
Bosnia has a great rubies and great beer
00:01:09.080
yeah and okay uh let's uh please let me
00:01:12.680
introduce you to the great International
00:01:15.680
Ruby conference in Japan uh the
00:01:17.680
conference is called Rubik gagi uh one
00:01:20.520
of the key future of this conference is
00:01:23.960
uh where you want uh find talk talks
00:01:27.119
about CL Source product or soft topics
00:01:31.520
uh instead it's a place for open source
00:01:35.000
developers to talk about the open source
00:01:38.960
code related to Ruby the de developed uh
00:01:42.880
additionally this is the part
00:01:44.880
participation of many Ruby commits and
00:01:47.520
rubies from various
00:01:49.560
countries uh if you want to feel the the
00:01:52.680
energy and passion many and R in Japan
00:01:56.719
and let's meet next April in AIM Japan
00:02:00.640
not only will be surrounded by
00:02:03.840
enthusiastic list uh but you also
00:02:08.599
experience incredible roal cing and some
00:02:12.440
of best hot spring we looking forward to
00:02:16.480
welcoming you okay so and this talk has
00:02:20.760
process uh posess uh POS posible thanks
00:02:24.720
to General support from Ruby Association
00:02:28.040
in Japan K nion Ru no
00:02:30.720
F help to cover my Trav expenses I'm
00:02:34.200
incred incredibly grateful for St
00:02:38.000
support okay so let introduce myself I'm
00:02:41.000
UD I'm and this ydh uh call me wer is my
00:02:47.680
handle on social media you can call me
00:02:50.519
udai or
00:02:51.720
wer and I come from Osa Japan uh Osaka
00:02:55.879
is home to a famous Osa castle and is
00:02:59.560
know for as diverse Feld culture and uh
00:03:04.440
b performancing art I hope you will you
00:03:09.400
will visit okay back to my information
00:03:12.640
and my prob is doing open source
00:03:15.159
software programming in my R time and
00:03:18.720
I'm a member of ROP aspect team at ROP
00:03:22.080
headquarters specifically and I'm the
00:03:25.120
Mainer of ROP ARP ROP CA ROP Factory B
00:03:28.560
and the ROP arp
00:03:30.879
and I'm also member of commit
00:03:32.920
committee's maintenance team and I'm on
00:03:35.720
the maintenance team as as a committee
00:03:37.760
for Rama and I'm also contributive to
00:03:41.720
C okay I I I I've already published
00:03:45.080
today slide uh you can you can see the
00:03:47.920
slide if you um load this QR code or I'm
00:03:52.799
also sharing it on X or M after this
00:03:56.439
talk please SE the PO and find this
00:03:59.519
thing
00:04:00.599
okay all right uh let's start today talk
00:04:04.239
and today's talk is about Rama uh so I
00:04:07.720
have very good news for our R pres F of
00:04:11.200
here uh this is the first talk in Europe
00:04:14.920
about uh Yama and I'm excited to share
00:04:18.680
it really
00:04:20.040
you okay so let's begin our journey of
00:04:23.160
story about Rama okay Rama is a person
00:04:26.960
generated that generated generated
00:04:30.440
puzzle using the puzzle implemented by
00:04:34.440
Ruby
00:04:36.120
it's
00:04:38.000
puzzle say languages where pass as input
00:04:43.919
PR is sp was generated using the univers
00:04:49.280
generator but since Ruby version
00:04:53.160
three3 the dur using
00:04:57.000
vama so why did you from
00:05:01.479
unama there are two main reasons first
00:05:05.280
uh we need to support multiple BS of
00:05:08.919
Bison because when Ruby uses ra Ruby
00:05:13.600
from uh sasod it uses the bon in
00:05:18.479
installed in their environment so there
00:05:22.960
need to be able to build with different
00:05:27.600
version of braon
00:05:30.479
as a result new Futures added to bison
00:05:33.800
were not immediately
00:05:37.080
available and second uh it had to add
00:05:40.520
future to Extended bison uh bison is not
00:05:45.039
only used by Ruby uh of course but also
00:05:49.280
by many other users for for example a
00:05:52.520
PHP Pro MyQ
00:05:55.400
post uh so and changing it requires a
00:05:59.720
lot of sing and discussions so it makes
00:06:03.680
made sense to move from B to
00:06:07.280
Rama and the current R men team consists
00:06:11.240
of three people the or ualo and two
00:06:15.160
committed Joi and
00:06:17.759
me uh when you uh so uh so uh when you
00:06:23.319
first s the name Rama you probably s
00:06:26.800
pronunciation is so difficult right uh
00:06:30.240
so it's pronounced like Lama uh yes it
00:06:34.039
is the same as animal Yama it is named
00:06:37.919
after the compatible P generat yak and
00:06:40.960
bison it's named for the F and croud Rob
00:06:45.520
AR like B so why not l m you might think
00:06:53.360
uh however our Lama generates uh
00:06:57.479
LR puzzle generator so it's Rama all
00:07:01.800
right okay so next uh let's talking
00:07:05.520
about
00:07:06.840
uh puzzle that Lama
00:07:11.120
generated L puzzle means it look had one
00:07:15.560
second in input stream to decide what to
00:07:18.479
do and left to right scanning of the of
00:07:21.599
the input and the Rion that replaces the
00:07:25.759
light most non terminal symbols of a s
00:07:29.080
sentence form at each St inion is called
00:07:32.960
the rightmost
00:07:34.800
delion this section is summar is Lama is
00:07:39.160
a p Ruby generator and in Ruby version
00:07:44.440
version three do repace with
00:07:49.759
and refers toad right to left to right
00:07:54.840
like most
00:07:56.560
present okay let's now move on to the
00:08:00.199
components related to passing in rby
00:08:03.440
this three relevant components are the
00:08:06.560
Rexel and pass and the comparator
00:08:09.199
strictly speaking Lex and pass are T Rec
00:08:13.280
so building is performs for each token
00:08:17.159
sprit by Le but it's described here as a
00:08:22.000
separate phase for exper
00:08:24.960
explanation the text is transformed by
00:08:28.000
each module into token and Abstract
00:08:30.560
syntax phrase and
00:08:33.000
instruction okay let's start with
00:08:35.839
SEL uh in this pH Le spr the text into
00:08:39.360
tokens uh this means that the Ruby C
00:08:42.919
code you write is now converted into
00:08:46.640
tokens uh let's look at example uh
00:08:50.040
method definition shown on this SL uh
00:08:53.560
this text is D SP m t h o d blah blah is
00:08:59.880
understandable to us as a meaningful
00:09:02.959
string uh but it is really just string
00:09:06.800
string of bites yeah so uh let's spread
00:09:11.120
into set of meaningful characters into
00:09:14.519
tokens for example Rex spr the method
00:09:18.120
name death bances and blah blah blah uh
00:09:21.959
into meaningful set of characters this
00:09:24.880
is the RO of Lex
00:09:27.360
analysis okay and so let's move let's
00:09:30.360
move on to the paring phase this phase
00:09:33.560
takes token spread by and creates um
00:09:36.959
abstract index we and this phas checks
00:09:40.399
the tokens uh and and this pH check
00:09:43.839
checks the tokens received from and for
00:09:48.560
grammatical uh conformance and B on
00:09:52.320
abstract Sy Tex 3 and appropriate err
00:09:55.600
Hing is done for grammatical in cor
00:09:58.519
programs
00:10:00.320
therefore it it is uh responsibility of
00:10:03.519
the P to convert string of token theed
00:10:07.000
from Rex into an abstract sytax
00:10:10.120
3 and you can leun L dump part three
00:10:14.800
option to see what the proc does this is
00:10:17.560
a uh
00:10:19.720
HDR 3 yeah finally uh the compare phases
00:10:25.079
uh compare the abstruct syry into B
00:10:27.720
codes that we have can execute and Y
00:10:31.279
then executes the B code and execute the
00:10:34.279
program and so Y is wait wait wait uh we
00:10:39.519
completely understand what what y we has
00:10:44.120
the Y Creator canot yesterday right so
00:10:47.399
skip okay and so you can see how the
00:10:51.600
compar works by printing the results of
00:10:55.120
the rubby V instruction sequence compar
00:10:57.920
method like this
00:11:00.639
okay now that we have seen the
00:11:03.959
components associated with what that Pro
00:11:08.120
generator
00:11:09.279
do uh the pro generator generates a POS
00:11:12.839
from former grammar specification uh it
00:11:15.920
takes a set of rules that Define the
00:11:19.000
syntax of programming language or dat
00:11:21.680
format and journal code that can pass
00:11:25.519
strings according to those
00:11:28.240
rules the pass generator as shown in the
00:11:32.120
figure uh reses the fire defining the RS
00:11:36.839
and generates P
00:11:39.680
CL and this section summaries component
00:11:43.279
related to passing Rex and the and the
00:11:46.680
compor puzz generator generates a puzzle
00:11:49.519
Square from setup Pro defining the
00:11:52.399
syntax of programming languages over
00:11:54.600
this
00:11:55.519
format okay
00:11:57.720
and conf this uh complet this the
00:12:01.120
introduction to the component related to
00:12:04.200
P in Ruby so let's move on the pz
00:12:07.560
grammar what is a puz
00:12:09.959
grammar uh the good way to understand
00:12:12.680
the grammar handles by puing from uh the
00:12:16.079
diagram on CH SK hierarchy which is a
00:12:19.399
inclusion hierarchy of foral grammar
00:12:21.680
that generates foral
00:12:24.079
langages uh in person uh if you work at
00:12:27.480
the Bison documentation and in order for
00:12:30.279
prison to pass languages uh it must be
00:12:34.920
described by context fre gramar yeah the
00:12:38.839
same is true for Rama so if you look at
00:12:43.160
the diagram of chy hierarchy this is
00:12:46.920
which Aros as
00:12:50.240
possible so what's the grammar for
00:12:52.920
expressing context free grammar is Bast
00:12:55.760
n from as as BNF has a notation for
00:13:00.399
expressing context fre grammar BNF is a
00:13:03.920
standard format for describing context
00:13:06.480
fre grammar and it's uh is used and to
00:13:11.440
define the syntax of programming
00:13:13.519
language languages and
00:13:16.360
protocol okay so let's take this BNF as
00:13:20.959
an example this is an an example of B
00:13:25.040
BNF the that uh represents the addition
00:13:29.320
of
00:13:30.880
numbers this can be divided into two
00:13:35.279
main categories uh RS and rhs and simply
00:13:40.079
put uh rhs is a symbol being expanded
00:13:45.760
and rhs is the result of that
00:13:49.880
expansion two types of symbols exist in
00:13:53.639
and and two types of symbols exist in
00:13:56.240
the generation R section uh first
00:13:59.600
terminal symbols are final plus symbols
00:14:02.480
that are not not further expanded
00:14:06.120
corresponding to concrete word or tokens
00:14:10.199
like a keyword identify rals in the
00:14:14.360
program and non-terminal symbol are
00:14:17.639
symbols that further expanded into other
00:14:20.839
terminal or non-terminal symbols
00:14:22.920
according to gramal rules then
00:14:26.399
represented uh inter intermediate
00:14:29.160
structural or Sy syntactic parts of
00:14:34.480
grammar and uh I here is a part of
00:14:38.800
defining actions this defin the pro
00:14:42.480
processing and action to perform based
00:14:45.079
on the grammar rules during passing
00:14:47.839
while passing itself uh construct a
00:14:51.680
syntax three according to gramar rules
00:14:53.959
sections are executed in process and
00:14:56.880
performance perform processing related
00:14:59.279
to syntax construction semantics
00:15:02.240
analytics and c and
00:15:06.279
so the seel in action can refer to the
00:15:10.519
semantic barer of components matched by
00:15:13.480
the lules uh with construct J N in uh
00:15:19.759
which stand for the Val of n components
00:15:25.120
for example uh there one in the top
00:15:28.120
right and ref to the value of the token
00:15:31.639
named
00:15:32.959
number D behaves uh like a written value
00:15:37.759
uh in this example uh the sum is St into
00:15:41.800
Z so that it becomes the semantic value
00:15:46.560
of addition addition expression just
00:15:49.839
recognized by it
00:15:51.360
rule okay uh that concludes our
00:15:55.480
introduction to the basics of BNF
00:15:59.800
and uh in lby the generation rules
00:16:03.360
tokens actions and error handing is are
00:16:06.639
really leing in BNF in the file named
00:16:10.839
pass by pass by is like a blueprint that
00:16:15.240
tell Ruby how to understand it and
00:16:18.560
execute programs by breaking down codes
00:16:21.639
into its fun fundamental components and
00:16:25.639
rules okay so this section summaries
00:16:30.440
context context free grammar and context
00:16:33.399
free grammar can express using prast
00:16:37.079
from and lby use BNF in F called pass to
00:16:42.920
Define Luby grammar and
00:16:45.720
behav okay I I explained the basics
00:16:49.399
about sper and Rama okay let's talk
00:16:52.480
about how does rama makes the Pres
00:16:55.519
gramar
00:16:57.240
go uh I would like to consider what the
00:17:01.399
problem was in first
00:17:03.919
place there were number of issue uh but
00:17:08.439
one one of which uh was mity issue it is
00:17:13.400
say that pass why is very difficult uh
00:17:17.199
for example it can be metaphorically
00:17:21.000
described as a demon Castle H and monra
00:17:25.280
monra yeah so what's the
00:17:29.480
party uh one one of the reasons for this
00:17:33.559
is that the grammar provided by bison is
00:17:36.720
so
00:17:38.320
primitive okay so let's look at what it
00:17:42.120
means to have only primitive
00:17:45.200
grammar okay uh let's go to First topic
00:17:49.200
uh the first topic is the difficulty
00:17:52.400
with number
00:17:54.679
parameter as mentioned earlier the C
00:17:57.520
coding action can refer to the semantic
00:18:00.400
value of the components that M matches
00:18:04.400
the rules using the construct that are
00:18:07.679
where n uh which represents the bar of
00:18:11.840
the N components uh this example is very
00:18:15.840
reable but it's actually more
00:18:19.799
complicated uh this is a real case in
00:18:23.600
passway uh but some action codes are
00:18:27.320
omitted for exper
00:18:30.400
experation uh when defined in the this
00:18:33.880
way it would be very difficult to know
00:18:37.000
which index is the fifth or
00:18:41.280
seventh um the correct answer is
00:18:45.600
f f AR is Fifth and L L Lambda body is
00:18:54.799
s therefore uh so we uh therefore named
00:18:59.880
reference was introduced by junk 0
00:19:05.919
0612 this is one of the future of Bon
00:19:10.159
this future allows the original symbol
00:19:13.720
name to be used as a n refer you can
00:19:17.559
also assign um our areas for refines by
00:19:21.880
enclosing it in square bracket in the
00:19:25.960
lower
00:19:27.720
description for example uh let's write
00:19:31.039
this BF using named
00:19:33.559
reference named reference allow you to
00:19:36.480
describe reference as this right okay in
00:19:41.360
this way uh references can be made by
00:19:44.919
the name of symbol on the
00:19:49.360
rhs and LS can also be utilized this way
00:19:54.520
to make references in actions are easier
00:19:58.720
to understand in this way we were able
00:20:01.919
to make the references of the action
00:20:06.600
Al
00:20:10.640
comprehensible yeah okay so move to uh
00:20:14.799
second uh before I explain the issue uh
00:20:18.919
I want to think about for a
00:20:22.000
moment uh okay what would you do if you
00:20:26.480
had duplicate code or logic in the
00:20:29.360
software you were
00:20:34.760
developing in do we um maybe break down
00:20:39.360
system into reable components like
00:20:42.600
methods modules classes to avoid
00:20:47.120
dation
00:20:48.640
iners uh is there's no way to do
00:20:53.159
aning
00:20:54.720
yeah if you have had this part you will
00:20:58.360
May be you will be aware of the fact
00:21:01.960
that there is no means of abstraction in
00:21:04.880
bison like there is in
00:21:08.120
message so all right uh let's look at
00:21:10.919
real case uh this is a BMF representing
00:21:14.880
keyword
00:21:16.120
arguments and this is the BNF that
00:21:19.960
represents the keyword argument in the
00:21:23.120
block and so notice that the those two
00:21:27.640
have all the same structure and same
00:21:30.679
actions expect ex except for some non-
00:21:33.760
terminal
00:21:36.600
symbols
00:21:38.480
okay and but we didn't have the syntax
00:21:42.120
to structure the
00:21:45.799
things so therefore uh I introduced the
00:21:49.480
parameterizing
00:21:52.120
rules uh what this means is that the
00:21:55.480
differen of a non-terminal symbol can be
00:21:59.000
parameter with any number of other
00:22:01.880
terminal or non-terminal symbols in the
00:22:04.679
Jing rues in short naming the pattern
00:22:08.440
clarifies the in intent of the rule and
00:22:12.159
arrow for pattern
00:22:14.559
RS the idea for this parameterizing rule
00:22:17.799
was not conceived from scratch but was
00:22:23.480
implemented uh based on the fun uh
00:22:27.080
functionality implemented in main here
00:22:31.880
and Generator for
00:22:35.520
C if we apply the parameterizing rules
00:22:39.600
the these two generating rules with the
00:22:43.200
same structure and same
00:22:46.480
action okay so this is after uh this is
00:22:50.440
obstruction AR as to extract gener
00:22:53.919
generating rule with common actions and
00:22:56.880
structures for it right R have major
00:22:59.919
parts of generation Lo in
00:23:03.760
Insanity in insan Insanity uh
00:23:07.960
simple uh for the first time it is
00:23:11.200
possible to extract the structure where
00:23:13.960
through this POS
00:23:16.240
grammar the parameterizing rules uh is
00:23:19.520
defined in the in this way and this is a
00:23:23.440
parameterizing rule indicating options
00:23:26.400
that is generic
00:23:29.320
structure uh let's look at it from the
00:23:32.400
left side uh option is the name of par
00:23:37.240
parameterizing name uh par
00:23:39.400
parameterizing Rule and X indicates uh r
00:23:43.039
x indicates the
00:23:44.760
arguments and the x r x on the right
00:23:48.720
side is expanded to argument pass by the
00:23:52.240
using the rule as the
00:23:54.720
parameters refers to uh the Sy symol
00:23:58.440
expand it to
00:24:01.000
RX okay so let's look at example of this
00:24:06.200
generation rules adapting the
00:24:08.400
parameterizing rule to
00:24:10.480
it uh rewriting using uh the
00:24:13.720
parameterizing rule for the generation
00:24:16.200
rule like looks like would look like
00:24:21.240
this and in in this case the back
00:24:25.399
structure and passed on the side using
00:24:28.080
the parameterizing rule is expanded and
00:24:31.399
so uh back slash and is also expanded on
00:24:35.679
right side the parameters passed on the
00:24:39.679
side using the parameterizing rule are
00:24:44.600
expanded we now have the way for
00:24:47.840
structuring but uh wouldn't we also want
00:24:52.080
to use very generic structures
00:24:54.480
parameterizing rule for example without
00:24:57.080
having to Def find
00:25:00.080
them so liama uh provides those General
00:25:05.120
parameterizing R in form of the standard
00:25:10.640
rary uh liama provide the standard rary
00:25:13.679
of rules with the general structure such
00:25:17.360
as option or list and so standard R is
00:25:22.480
St in
00:25:26.000
five standard
00:25:28.559
Y which is embedded inside grammar file
00:25:33.000
when before
00:25:34.880
parting and we also provide various for
00:25:38.600
the three rules option list and Nod list
00:25:42.679
which can be leing like regular
00:25:45.840
Expressions this arrows for simpar
00:25:50.240
Expressions so uh the stand and rs is
00:25:53.919
out of this generation rues to be
00:25:57.679
expressed
00:25:58.880
in this simple
00:26:00.720
way so we have gained what in LS could
00:26:06.000
be uh compared to having method
00:26:09.600
definitions and the standard Riv at our
00:26:13.919
disposal okay so I explained some
00:26:17.640
approaches to improving
00:26:20.880
ZR uh I think so Ruby versus grma it's
00:26:24.360
now go right
00:26:29.399
okay so this section summaries are
00:26:33.720
correct currently where the replacement
00:26:37.039
of the P generator from bison Rama we
00:26:40.880
have more powerful and richer
00:26:43.760
grammar and named references Sol the
00:26:47.200
problem of e how to raise references and
00:26:51.600
parameter rle parameterizing rules gave
00:26:53.840
us great power to abstract
00:26:57.039
structures and and the
00:27:00.000
syntax continues to
00:27:03.399
explod Evol and the greatest of our time
00:27:08.080
uh continue to be updated on daily
00:27:12.080
basis uh as syntaxes not com covered in
00:27:17.440
today's talk includes the design and
00:27:20.240
implementation on
00:27:22.960
uh of in lining on the conditional
00:27:26.679
Expressions this this is where gets more
00:27:29.840
power to the Pres gramar I
00:27:33.640
think okay finally
00:27:36.559
conclusion conclusions one of the
00:27:39.720
problem with pass by was the issue of
00:27:43.600
mention
00:27:44.760
ability it was suggested that just
00:27:48.159
extending the grammar would bring
00:27:51.200
significant Improvement to the Ruby part
00:27:53.919
of
00:27:54.640
gramar the syntax uh continues to evolve
00:27:59.000
s sort out the development of RMA and
00:28:03.559
the gos continue to be updat
00:28:07.679
the and so it's not just mental brity
00:28:11.559
issues that R want to solve this is a
00:28:15.120
lot to map and we have a lot of
00:28:18.960
goals so we will continue to improve Rao
00:28:23.159
and Pathway to take for advantage of of
00:28:28.240
the great power of
00:28:32.080
aor okay uh if you are interested in the
00:28:35.360
Rama project for please consider giving
00:28:38.240
it uh St on GitHub and also we are
00:28:42.240
always looking for your feedback and we
00:28:44.799
also want to be a part of this project
00:28:48.200
if you
00:28:49.399
interested okay so let's rebar the fa
00:28:52.559
future of the bus together okay thank
00:28:55.279
you