Skip to content

Commit

Permalink
Merge pull request #1 from Felienne/master
Browse files Browse the repository at this point in the history
update fork from original
  • Loading branch information
jeannegoossens authored Apr 24, 2020
2 parents 6921a23 + 47fece9 commit 5c13643
Show file tree
Hide file tree
Showing 17 changed files with 329 additions and 158 deletions.
198 changes: 109 additions & 89 deletions STATUS.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,119 @@
# Status of Things
Please add your name in the table when you want to work on a specific thing, so others can focus on stuff that has not been started on yet ^^ Something will get a 'V' after the pull requests gets accepted and the stuff is merged to the master-branch. Or, with the youtube-content, when the video is recorded and ready for uploading. Or, with the youtube-subtitling, when the subtitles are accepted and online. Happy coding/writing!
# Status of Things
This page presents an overview of content in different languages. If you want to translate hedy to a new language, this is a good list to follow.

## Contents
[Website general](#Website-general)
[Levels - practice page](#levels-practice-page)
[Levels - docs](#Levels-docs)
[Youtube videos](#Youtube-videos)
[Youtube Subtitling](#Youtube-Subtitling)
Please add your name in the table when you want to work on a specific thing, so others can focus on stuff that has not been started on yet. Something will get a 'V' after the pull requests gets accepted and the content is merged to the master-branch. Or, with the youtube-content, when the video is recorded and ready for uploading. Or, with the youtube-subtitling, when the subtitles are accepted and online. Happy coding/writing!

## Contents
* [Website general](#Website-general)
* [Levels - practice page](#levels-practice-page)
* [Levels - docs](#Levels-docs)
* [Youtube videos](#Youtube-videos)
* [Youtube Subtitling](#Youtube-Subtitling)

[Back to top of page](#status-of-things)

[Back to top of page](#status-of-things)
## Landing page
Content for the landing page is stored in the [main folder](main). There currently are three pages: contact, press and start. There is also a [json file](main/menu.json) that generates the menu. The landing page is currently available in Dutch and English.

## Website general
The main general website texts you can find here [here](static/texts.json).
The specific contact info per language is found [here](/docs), in the contact-LANGUAGE-md files.
| |NL|EN|ES|..|
|--|--|--|--|--|
|website general| V | V | V | |
|contact page| V | V | | |
[Back to top of page](#status-of-things)
| |NL|EN|ES|..|
|--|--|--|--|--|
|start| V | V | | |
|press| V | V | | |
|contact| V | V | | |
[Back to top of page](#status-of-things)

## Coding Environment
Texts in the coding environment, such as error messages, are stored in [texts.json](static/texts.json).

## Levels - practice page
To be found [here](/static), in the json files.
| |NL|EN|ES|..|
|--|--|--|--|--|
|Texts| V | V | V | |

| |NL|EN|ES|..|
|--|--|--|--|--|
|level 1| V | V | V | |
|level 2| V | V | V | |
|level 3| V | V | V | |
|level 4| V | V | V | |
|level 5| | | | |
|level 6| | | | |
|level 7| | | | |
|level 8| | | | |
|level 9| | | | |
|level 10| | | | |
|level 11| | | | |
|level 12| | | | |
|level 13| | | | |
[Back to top of page](#status-of-things)
In addition to the generic texts, the coding environment has three pages: code, explanation and videos.

## Levels - docs
| |NL|EN|ES|..|
|--|--|--|--|--|
|level 1| V | V | V | |
|level 2| V | | | |
|level 3| V | | | |
|level 4| V | | | |
|level 5| | | | |
|level 6| | | | |
|level 7| | | | |
|level 8| | | | |
|level 9| | | | |
|level 10| | | | |
|level 11| | | | |
|level 12| | | | |
|level 13| | | | |

[Back to top of page](#status-of-things)
### Code
Code texts are taken form the [levels file](static/levels.json), which also controls which levels are available in the interface. Only when a level is present in a given language, it will be possible to access it in the website.

| |NL|EN|ES|..|
|--|--|--|--|--|
|level 1| V | V | V | |
|level 2| V | V | V | |
|level 3| V | V | V | |
|level 4| V | V | V | |
|level 5| V | V | | |
|level 6| V | V | | |
|level 7| V | V | | |
|level 8| | | | |
|level 9| | | | |
|level 10| | | | |
|level 11| | | | |
|level 12| | | | |
|level 13| | | | |
[Back to top of page](#status-of-things)


### Levels - Explanation
To be found [here](/docs), in the md files. For example [en-level1.md](docs/en-level1.md) holds the page for level 1 in English.

| |NL|EN|ES|..|
|--|--|--|--|--|
|level 1| V | V | V | |
|level 2| V | | V | |
|level 3| V | | | |
|level 4| V | | | |
|level 5| V | | | |
|level 6| V | | | |
|level 7| | | | |
|level 8| | | | |
|level 9| | | | |
|level 10| | | | |
|level 11| | | | |
|level 12| | | | |
|level 13| | | | |
[Back to top of page](#status-of-things)

### Levels - video page
To be found [here](/docs), in the md files. For example [video-nl-level3.md](docs/nl-level3.md) holds the video page for level 3 in Dutch (nl). We would love for people to record explanation videos in their own language!

## Youtube videos
| |NL|EN|ES|..|
|--|--|--|--|--|
|Philosophy| | V | | |
|level 1| V | | | |
|level 2| V | | | |
|level 3| | | | |
|level 4| | | | |
|level 5| | | | |
|level 6| | | | |
|level 7| | | | |
|level 8| | | | |
|level 9| | | | |
|level 10| | | | |
|level 11| | | | |
|level 12| | | | |
|level 13| | | | |
[Back to top of page](#status-of-things)
| |NL|EN|ES|..|
|--|--|--|--|--|
|level 1| V | | | |
|level 2| V | | | |
|level 3| V | | | |
|level 4| V | | | |
|level 5| V | | | |
|level 6| V | | | |
|level 7| | | | |
|level 8| | | | |
|level 9| | | | |
|level 10| | | | |
|level 11| | | | |
|level 12| | | | |
|level 13| | | | |

[Back to top of page](#status-of-things)


### Youtube subtitling

## Youtube subtitling
| |NL|EN|..|
|--|--|--|--|
|Philosophy| | | |
|level 1| | | |
|level 2| | | |
|level 3| | | |
|level 4| | | |
|level 5| | | |
|level 6| | | |
|level 7| | | |
|level 8| | | |
|level 9| | | |
|level 10| | | |
|level 11| | | |
|level 12| | | |
|level 13| | | |
[Back to top of page](#status-of-things)
Our videos now have no subtitles, but in lieu of videos in other languages, the English ones could also be subtitled. This task has not been started yet.

| |NL|EN|..|
|--|--|--|--|
|Philosophy| | | |
|level 1| | | |
|level 2| | | |
|level 3| | | |
|level 4| | | |
|level 5| | | |
|level 6| | | |
|level 7| | | |
|level 8| | | |
|level 9| | | |
|level 10| | | |
|level 11| | | |
|level 12| | | |
|level 13| | | |
[Back to top of page](#status-of-things)

> Written with [StackEdit](https://stackedit.io/).
50 changes: 50 additions & 0 deletions THOUGHTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Some thoughts about Hedy design
======================

This document contains some design decisions and corresponding thoughts for future reference.
It is mainly Felienne's internal monologue, but feel free to read along!

##General thoughts
###Fix or warn or break?
Several issues in code can be fixed, in fact this is one of the main benefits of Hedy I would say.
This does lead to the fact that decision need to be made for each case whether we silently fix, warn or break.
For example, starting a line with a space. Do we allow it? It is important for kids to realize at one point that in Python and thus in Hedy
spaces have meaning, and only have meaning at the beginning of a line. For now, this is a warning.
Same question could be asked for case sensitivity of keywords. Do we allow it, and add a level where we tell kids it is then no longer allowed?
I am still deciding.


##Thoughts per level

###Level 2

####Use of spaces

In Level 2, print now needs one space:
```command: "print " (" " | text | punctuation | list_access)* -> print```

This makes processing easier, but has as a down side that ```print``` without an argument does not parse and thus not get a nice
error message. This could be fixed by more complicated processing.

Also in Level 2, ```print hello world!``` works, but prints "hello world!".
I am not sure I like this behaviour. On the one hand side, this is a nice extra reason why we want quotation marks, to be able to tell Hedy that you really want spaces.
On the other hand, it breaks the promise that we literally print what is behind the keyword print.

####Punctuation
The level 2 grammar has a separate rule for punctuation: ? ! and .
This is the case because we want to be able to print variables followed by punctuation without a space:
For example this code:

`name is Felienne
print hello name!`

should result in "hello Felienne!" and not "hello Felienne !"

###Level 3

#### Quotes only in print
In Level 3, we introduce the use of quotation marks in the `print` statement. In `ask`, this is not needed.
The reasoning for this is that `print` is a 'real' statement which will occur in Python too and we want to build up to that.
`ask` will be replaced by a function call later on and as such does not really need to be real.
I have heard form users this is confusing, which I understand! We might want to change this at one point, or
provide a better error message to explain the different with `print`.
15 changes: 12 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,21 @@ def parse():
# is so, parse
else:
try:
texts = load_texts()
result = hedy.transpile(code, level)
response["Code"] = "# coding=utf8\n" + result
except hedy.HedyException as E:
texts = load_texts()
error_template = texts['HedyErrorMessages'][E.error_code]
response["Error"] = error_template.format(**E.arguments)
# some 'errors' can be fixed, for these we throw an exception, but also
# return fixed code, so it can be ran
if E.args[0] == "Invalid Space":
error_template = texts['HedyErrorMessages'][E.error_code]
response["Code"] = "# coding=utf8\n" + E.arguments['fixed_code']
response["Warning"] = error_template.format(**E.arguments)
else:
error_template = texts['HedyErrorMessages'][E.error_code]
response["Error"] = error_template.format(**E.arguments)


except Exception as E:
print(f"error transpiling {code}")
response["Error"] = str(E)
Expand Down
2 changes: 1 addition & 1 deletion docs/en-level1.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For all of the following lines:
* `ask The main character of this story is ...`
* `print The main character of this story is ...`
* `print He walks in the forest`
* `acho He is a little scared ...`
* `echo He is a little scared ...`
* `print He hears crazy sounds everywhere`
* `print He is afraid this is a ghost forest`

Expand Down
3 changes: 0 additions & 3 deletions docs/video-en-level1.md

This file was deleted.

27 changes: 16 additions & 11 deletions grammars/level2.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
start: program
program: _EOL* command (" ")* (_EOL+ command (" ")*)* _EOL* //lines may end on spaces and might be separated by many newlines
command: "print " ( list_access | (text punctuation)| text) (" " ( list_access | (text punctuation)| text) )* -> print
| text " is ask " textwithspaces punctuation* -> ask
| text " is " text ((", "|",") text)+ -> assign_list
| text " is " text -> assign //placing it here means print is will print 'is' and print is Felienne will print 'is Felienne'
| text " " textwithspaces -> invalid
command: "print " (" "| list_access | textwithoutspaces | punctuation)* -> print
| var " "+ "is ask " + (" " | text | punctuation)* -> ask
| var " is " text ((", "|",") text)+ -> assign_list
| var " is " text -> assign
| textwithoutspaces " " text -> invalid

_EOL: "\r"?"\n"

ACCENTED_LETTER: "á" | "é" | "ó"

var: LETTER+ -> var
list_access : var " at " (index | random) -> list_access
index : DIGIT+
random : "random"

punctuation : PUNCTUATION -> punctuation
textwithspaces: (LETTER | ACCENTED_LETTER | DIGIT | WS_INLINE)+ -> text
text: (LETTER | ACCENTED_LETTER | DIGIT)+ -> text
PUNCTUATION: "!" | "?" | "." //uppercase places tokens in tree

text: /([^\r\n,!?.]+)/ -> text //anything can be parsed except for a newline and a comma for list separators
//plus in Level 2 we need to treat punctuation differently, since it can be used to separate arguemnts (variables)

textwithoutspaces: /([^\r\n,!?. *+-\/]+)/ -> text //anything can be parsed except for spaces (plus: a newline and a comma for list separators)
//plus in Level 2 we need to treat punctuation differently, since it can be used to separate arguemnts (variables)

var: NAME -> var


%import common.LETTER // imports from terminal library
%import common.DIGIT // imports from terminal library
%import common.WS_INLINE // imports from terminal library
%import common.NEWLINE // imports from terminal library

%import common.CNAME -> NAME


23 changes: 14 additions & 9 deletions grammars/level3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,33 @@ program: _EOL* command (" ")* (_EOL+ command (" ")*)* _EOL* //lines may end on s
?command: print
| ask
| assign_list
| assign //placing it here means print is will print 'is' and print is Felienne will print 'is Felienne'
| invalid //catch all
| assign
| invalid //catch all at the end

_EOL: "\r"?"\n"

print : "print " (quoted_text | list_access | var) (" " (quoted_text | list_access | var))*
ask : var " is ask " textwithspaces*
assign_list: var " is " textwithspaces ((", "|",") textwithspaces)+
assign : var " is " textwithspaces
invalid: textwithspaces
print: "print " (" "| list_access | quoted_text | var)* -> print

ask : var " " + "is ask " + (" " | text | punctuation)*
assign_list: var " is " text ((", "|",") text)+
assign : var " is " text
invalid: textwithoutspaces " " text

punctuation : PUNCTUATION -> punctuation
PUNCTUATION: "!" | "?" | "." //uppercase places tokens in tree

var: NAME -> var
list_access : var " at " (index | random) -> list_access
index : NUMBER
random : "random"

textwithspaces: /([^\n,]+)/ -> text //anything can be parsed except for a newline and a comma for list separators
text: /([^\n,]+)/ -> text //anything can be parsed except for a newline and a comma for list separators
//punctuation does not need to be treated differently anymore

quoted_text_no_escape: /'([^']*)'/ -> text //simply all between quotes should this be used at earlier levels?
quoted_text: /'((?:[^\\']|\\.)*)'/ -> text //text can be between single quotes, but quotes may be escaped with \


textwithoutspaces: /([^\r\n, *+-\/]+)/ -> text //anything can be parsed except for spaces (plus: a newline and a comma for list separators)

%import common.LETTER // imports from terminal library
%import common.DIGIT // imports from terminal library
Expand Down
2 changes: 1 addition & 1 deletion grammars/level5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ equality_check: textwithoutspaces " is " textwithoutspaces
in_list_check: textwithoutspaces " in " var

//new for level 5
repeat: "repeat " NUMBER " times " command
repeat: "repeat " (NUMBER | var) " times " command

var: NAME -> var
list_access : var " at " (index | random) -> list_access //todo: could be merged with list_acces_var?
Expand Down
Loading

0 comments on commit 5c13643

Please sign in to comment.