PrestonKnopp / language-gdscript

gdscript language grammar package for atom.io
https://atom.io/packages/lang-gdscript
MIT License
32 stars 9 forks source link

Let's start make a Raku (RakugoScript) addon/transplier #30

Closed Jeremi360 closed 4 years ago

Jeremi360 commented 4 years ago

Hi @PrestonKnopp I almost finish working on rakugo 2.1.00. I just find out that raku in jap. means easy, comfort. So I recently start working on RakugoScript (Raku) using just GDScript Regex features and now I see that this is not enught. You can check out this attempt here: rakugo_script branch| , by running res://game/RakugoScriptTest.tscn it takes test.rkg and make test.rkg.gd

Now I want to try use tree-sitter instead so how I should start? Also here is my RakugoScript issue for refrence.

PrestonKnopp commented 4 years ago

Hey, that's awesome. Nice, RakugoScript should be easy and comfortable to use.

I think it would best to start by writing a syntax reference or grammar with a simplified standard notation. Notations such as PEG and BNF provide structure for you to define the rules of the language. Here's the grammar for fairyscript.

Once a grammar is in place, adapting it to tree sitter is straightforward.

Jeremi360 commented 4 years ago

O, thanks. After few readings of grammar for fairyscript. I thinks that I understand now BNF. I will start working on it soon. I have one question: <manuscript> ::= <block> is this means that all file is a <manuscript>?

PrestonKnopp commented 4 years ago

Yep! The <manuscript> is the root symbol and is effectively the file.

This means that if we have this fairyscript:

# a comment

It expands to the following AST:

- manuscript
  - block
    - statement
      - comment
        - "# a comment"

Do you have a public link to your grammar document? I'd like to help.

Jeremi360 commented 4 years ago

@PrestonKnopp Ups, I close this by mistake.

I'm sorry that I haven't responded for so long. I just had a lot on my mind and I didn't notice your question either. Yes, there is, but I just getting starting: https://github.com/jebedaia360/Raku

I learned that there is already a Raku language, maybe Raq? https://www.wikiwand.com/en/Raku_(programming_language)

Jeremi360 commented 4 years ago

@PrestonKnopp I added some grammar: https://github.com/jebedaia360/Raku/blob/lab/raku.bnf

So this will be correct grammar:

<definition> ::= "define" <whitespace>? <var_name> "=" .

for this:

define a = 3
define b = 0.3
define e = "some string"
define d = []
define e = {}
define f = false

I'm right?

Jeremi360 commented 4 years ago

@PrestonKnopp hello? Maybe you want to join to mu/rakugo discord it will make communitation to work on raku easier: https://discord.gg/WXDu6wX

PrestonKnopp commented 4 years ago

Hey, it's my turn to apologize now. I'm sorry I haven't responded in so long. I can't believe how time flies.

Nice, I'm following the Raku repo now.

<definition> ::= "define" <whitespace>? <var_name> "=" .

I have a couple suggestions:

  1. should be required after "define". I see that in raku.bnf, this change is already made.
  2. In place of dot after the "=" should be something like <expression> or if define only accepts literals: (<number> | <string> | <array> | <dictionary> | <boolean>).

Cool, I'll see you on discord.

PrestonKnopp commented 4 years ago

I'm actually going to close this and use Raku repo and discord for communication.