Code Monkey home page Code Monkey logo

Comments (11)

MattiaSpadoni avatar MattiaSpadoni commented on June 3, 2024 4

regular grammar
<sentence> ::= "I"
<sentence> ::= "you"
<verb> ::= "write"
<verb> ::= "read"
Possible sentences:
I write (terminal "I"+ non terminal <verb> in this case "write")
I read (terminal "I"+ non terminal <verb> in this case "read")
you write (terminal "You"+ non terminal <verb> in this case "write")
you read (terminal "you"+ non terminal <verb> in this case "read")

from 2018-2019.

ilsamoano avatar ilsamoano commented on June 3, 2024 3

Regular grammar possible generic sentence:
<non terminal> ::= "terminal"
<non terminal> ::= "terminal" <non terminal>

i.e.

<sentence> ::= "I"
<sentence> ::= "you"
<verb> ::= "write"
<verb> ::= "read"

possible example sentences

I write ("terminal" = "I" and <non terminal> = <verb>('write'))
I read ("terminal" = "I" and <non terminal> = <verb>('read'))
you write ("terminal" = "you" and <non terminal> = <verb>('write'))
you read ("terminal" = "you" and <non terminal> = <verb>('read'))

from 2018-2019.

delfimpandiani avatar delfimpandiani commented on June 3, 2024 1

From regular grammar with production rules:

<sentence> ::= "I" <verb>
<sentence> ::= "you" <verb>
<verb> ::= "write"
<verb> ::= "read"

Possible sentences:

I write ( <terminal> = "I"; <non-terminal>=<verb>("write"))
I read( <terminal> = "I"; <non-terminal>=<verb>("read"))
you write ( <terminal> = "you"; <non-terminal>=<verb>("write"))
you read ( <terminal> = "you"; <non-terminal>=<verb>("read"))

from 2018-2019.

VittoriaMoccia avatar VittoriaMoccia commented on June 3, 2024

Regular grammar rules can be summarized in:
<non-terminal> ::= "terminal"
<non-terminal> ::= "terminal"

For example, in order to create a sentence, this could be the combination:

<sentence> ::= "I" <verb>
<verb> ::= "eat"
<verb> ::= "sleep"

Possible combinations:
I eat (composed by the terminal "I" and the <non-terminal>/<verb> "eat")
I sleep (composed by the terminal "I" and the <non-terminal>/<verb> "sleep")

from 2018-2019.

tceron avatar tceron commented on June 3, 2024

Forms of production:
<non terminal> ::= "terminal"
<non terminal> ::= "terminal" <non terminal>

For instance:
<sentence> ::= "He" <verb>
<sentence> ::= "She" <verb>
<verb> ::= "runs"
<verb> ::= "works"

Possible combinations:
He runs ("terminal" = "He" and = <verb> "runs")
He works ("terminal" = "He" and = <verb> "works")
She runs ("terminal" = "She" and = <verb> "runs")
She works ("terminal" = "She" and = <verb> "works")

from 2018-2019.

friendlynihilist avatar friendlynihilist commented on June 3, 2024

Form of production rules for regular grammar:
<non-terminal>::="terminal" and <non-terminal>::="terminal" <non-terminal>

<sentence>::="I" <verb>
<sentence>::="We" <verb>

<verb>::="cry"
<verb>::="die"

I cry ("terminal" = I and <verb>, specifically <verb> = cry)
I die ("terminal" = I and <verb>, specifically <verb> = die)
We cry ("terminal" = We and <verb>, specifically <verb> = cry)
We die ("terminal" = We and <verb>, specifically <verb> = die)

That allows me to create all the two-word sentences having as a terminal either the first person singular or the first person plural pronoun accompanied by either the (non-terminal part) <verb> "cry" or the <verb> "die", for a total of four combinations.

from 2018-2019.

Ioanna96 avatar Ioanna96 commented on June 3, 2024

<sentence>::= "I" <verb>
<sentence>::= "They" <verb>
<verb>::= "walk"
<verb>::="fly"

I walk (terminal: "I", terminal: "walk", non-terminal: <verb> )
I fly (terminal: "I", terminal: "fly", non-terminal: <verb> )
They walk (terminal:"They", terminal: "walk", non-terminal: <verb> )
They fly (terminal:"they", terminal:"fly", non-terminal: <verb> )

from 2018-2019.

lisasiurina avatar lisasiurina commented on June 3, 2024

 Possible sentences that can be produced by using the regular grammar:

<non terminal> ::= "terminal"
<non terminal> ::= "terminal" 

Examples:

<sentence> ::= “I”
<sentence> ::= “You”
<verb> ::= “write” 
<verb>  ::= “read” 


Possible example sentences:

I write ("terminal" = "I" and  =  “write”)
I read ("terminal" = "I" and  = “read”)
You write ("terminal" = “You" and  =  “write”)
You read ("terminal" = “You" and  =  “read”)

from 2018-2019.

mchiaraf avatar mchiaraf commented on June 3, 2024

Form of production rules of regular grammars:
non-terminal ::= "terminal" and <non-terminal> ::= "terminal" <non-terminal>.

i.e.
<sentence> ::= "I" <verb>
<sentence> ::= "we" <verb>
<verb> ::= "run"
<verb> ::= "walk"

Considering these non-terminal elements we can produce four possible sentences:

  1. I run - <pronoun> ::= "I" and <verb> ::= "run"
  2. I walk - <pronoun> ::= "I" and <verb> ::= "walk"
  3. we run - <pronoun> ::= "we" and <verb> ::= "run"
  4. we walk - <pronoun> ::= "we" and <verb> ::= "walk"

from 2018-2019.

SeverinJB avatar SeverinJB commented on June 3, 2024

A sentence can either contain "I" plus a verb or "You" plus a verb. There are two defined verbs: "write" and "read". Hence, four constellations are possible.

  1. I write
  2. I read
  3. You write
  4. You read

from 2018-2019.

essepuntato avatar essepuntato commented on June 3, 2024

@MattiaSpadoni and @ilsamoano and @lisasiurina

<sentence> ::= "I"
<sentence> ::= "you"

There is something strange here... maybe you wanted to refer to <pronoun> instead of <sentence>?

from 2018-2019.

Related Issues (20)

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.