Skip to content

Commit

Permalink
Merge branch '#150-Modify-Correct-Parser-Code' of https://github.com/…
Browse files Browse the repository at this point in the history
…Typee-Language/Typee into #150-Modify-Correct-Parser-Code
  • Loading branch information
schmouk committed Feb 6, 2019
2 parents 319d4e2 + 89f7cc6 commit 54e24b2
Show file tree
Hide file tree
Showing 24 changed files with 415 additions and 203 deletions.
47 changes: 30 additions & 17 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a report to help us improve Typee environment

---

**Describe the bug**
A clear and concise description of what the bug is.

[_A clear and concise description of what the bug is._]
[_May deal with translator internal error,
erroneous translated syntax or unexpected behavior
when running translated code._]


**To Reproduce**

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

[_Ex._
1. _Directory Tree: Xxx/Yyy/Zzz/_
2. _Translated Typee module: mmm.ty_
3. _Command line as typed for translation: typee -opt1 -opt2 ..._
4. ...
5. ...
6. ... _any other valuable information to reproduce the error_]


**Expected behavior**
A clear and concise description of what you expected to happen.

[_A clear and concise description of what you expected to happen._]


**Screenshots**
If applicable, add screenshots to help explain your problem.

[_If applicable, add screenshots to help explain your problem._]


**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
- OS: [_e.g. iOS, MacOS X, Win32, Win64, Linux/Ubuntu, Linux/Fedora, ..._]
- Version [_e.g. 8_]
- Translator: [_e.g. C++17, C#, Java 8.1, Java for Android 9, Python 3.8, ..._]


**Additional context**
Add any other context about the problem here.

[_Add any other context about the problem here._]
[_For instance, you may copy here Typee code and finally erroneous translated code._]
17 changes: 12 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
about: Suggest an idea to enhance Typee project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

[_A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]_]


**Describe the solution you'd like**
A clear and concise description of what you want to happen.

[_A clear and concise description of what you want to happen._]


**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

[_A clear and concise description of any alternative solutions or features you've considered._]


**Additional context**
Add any other context or screenshots about the feature request here.

[_Add any other context or screenshots about the feature request here._]
141 changes: 141 additions & 0 deletions Language-specifications/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Typee Language Specifications

All successive versions of the specification of Typee language grammar are
put here.


## Versionning

The very first version of these specifications is not numbered. See file
`typee_specs_LL1.grm`.

Next versions are all numbered: `...-v2.grm`, `...-v3.grm`, ...,
`...-v9.grm` and currently `...-v9-1.grm` as the very last version of
document.

You'll notice that version `v4` is missing. Unfortunately, it has been lost
before being stored here...

Finally, since version `v8`, a second version of the specifications is
provided: `...-v8-EBNF.grm`, `...-v9-EBNF.grm` and `...-v9-1-EBNF.grm`.

Notice that Typee language is specified with a formal, unambiguous, LL(1)
grammar.


## Specification format

### Formal classical description

The used syntax to describe the grammar rules is very classical.
Rules are named between angle brackets: `<rule name>`. Those names may
be appended with single quote(s), to functionnaly group together different
strongly related rules.

The derivation rules of a grammar rule are specified after the rule name,
separated from this name by operator `::=`.

Literals are specified between single as well as double quotes: `'for'`,
`"'"`. Escaped chars in literals are preceded by an anti-slash: `'\''` is
equivalent to `"'"`, `'\n'` stands for newline, `'\\'` stands for single
anti-slash.

When defining literals, sets of characters are defined between brackets:
`[' ', '\n', '\f', '\r', '\t']` specifies the set of all spacing characters.

When defining literals, the ellipsis define an interval of characters
specified by the starting and the ending character:

<hexadecimal digit> ::= ['0'...'9', 'a'...'f', 'A'...'F']`

When defining literals, characters may be specified by their unicode code:
`u0x0041` stands for character 'A'.

When defining literals, groups of characters may be excluded from an interval
of characters with operator `-`:

<any non newline char> ::= u0x0000...u0xFFFF - ['\n', '\r', '\f']

The vertical bar `|` is used to specify options between derivations rules:

<boolean> ::= <TRUE> | <FALSE>
<TRUE> ::= 'true' | 'True'
<FALSE> ::= 'false' | 'False'

This "option" vertical bar separates groups of rules. There is no need to
group together successive rule names between parenthesis. Next specifications
are unambiguous:

<single string> ::= "'" <single string'> "'"
| '"' <ingle string"> '"'

<single string'> ::= <any escaped char> <single string'>
| <any string quote char> <single string'>
| EPS

<single string"> ::= <any escaped char> <single string">
| <any string doublequote char> <single string">
| EPS

Finally, keyword `EPS` specifies the empty (epsilon) rule. It specifies that
this rule may be not derived. In the above rules, it states that empty strings
formed as `''` or `""` are legal in Typee.


### Extended Backus-Naur Form (EBNF) description

This is a simplified and more easy to read format for grammar rules
specifications. We have been providing them since version `v8` of Typee
language grammar specification. Please notice that we still use the
classical format description of Typee grammar to implement the Front-End
Scanner and Parser modules.

The EBNF format accepts every classical description rules as listed in above
section. It adds factoring separators which help reduce the number of
derivation rules to specify a grammar rule.


Parenthesis `( )` are used to group grammar rules together:

<identifier> ::= ( <alpha char> | '_' ) <identifier'>
<identifier'> ::= ( <alpha num char> | '_' ) <identifier'>

Here, an identifier is specified as starting with either an alphabetical
character, i.e. any character from group `['A'...'Z', 'a'...'z']`, or with an
underscore, i.e. `'_'`, preceding any series of alphanumerical character and
undercores, i.e. any character from group `['0'...'9', 'A'...'Z', 'a'...'z', '_']`.

Parenthesis are also used jointly with an ending character star `'*'`. There,
they men that the derivations rules the group together may be derived from 0
to many times (with no limitations):

<identifier> ::= ( <alpha char> | '_' ) ( <alpha num char> | '_' )*

You can get here that this kind of factorization helps easying the reading of
grammars specifications as well as it helps reducing their specifications
sizes.


Brackets `[ ]` are used to specify that some group of derivation rules may be
derived at most once - which means that they may also not be derived. This
helps avoiding the use of keyword `EPS`:

<octal number> ::= '0' <octal char> ( ['_'] <octal char> )*
<octal char> ::= '0'...'7'

Here, octal numbers are specified as starting with character `'0'`, containing
then suites of any number of octal characters, i.e. characters from interval
`['0'...'7']`, maybe separated with single underscores. It specifies that in
Typee, `00` or `01_23_45_67` are legal octal numbers while `0123__4567` is not.



## Syntax Coloring

When reading a `.grm` file on Windows, we recommend you to use Notepad++. We
have created a dedicated profile file accessible here:
[grammars.xml](../Notepad%2B%2BXML-configs/),
that you just have to put it in the same directory as executable file
`notepad++.exe` on your computer. You will then enjoy syntax coloring when
opening `.grm` files with Notepad++ (but with a few limitations when reading
EBNF versions of those files - "no one is perfect").
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v2.grm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****
Copyright (c) 2018 Philippe Schmouker, Typee project, http://www.typee.ovh
Copyright (c) 2018-2019 Philippe Schmouker, Typee project, http://www.typee.ovh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v3.grm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****
Copyright (c) 2018 Philippe Schmouker, Typee project, http://www.typee.ovh
Copyright (c) 2018-2019 Philippe Schmouker, Typee project, http://www.typee.ovh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v5.grm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****
Copyright (c) 2018 Philippe Schmouker, Typee project, http://www.typee.ovh
Copyright (c) 2018-2019 Philippe Schmouker, Typee project, http://www.typee.ovh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v6.grm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****
Copyright (c) 2018 Philippe Schmouker, Typee project, http://www.typee.ovh
Copyright (c) 2018-2019 Philippe Schmouker, Typee project, http://www.typee.ovh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v7.grm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****
Copyright (c) 2018 Philippe Schmouker, Typee project, http://www.typee.ovh
Copyright (c) 2018-2019 Philippe Schmouker, Typee project, http://www.typee.ovh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v8-EBNF.grm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****
Copyright (c) 2018 Philippe Schmouker, Typee project, http://www.typee.ovh
Copyright (c) 2018-2019 Philippe Schmouker, Typee project, http://www.typee.ovh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Language-specifications/typee_specs_LL1-v8.grm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****
Copyright (c) 2018 Philippe Schmouker, Typee project, http://www.typee.ovh
Copyright (c) 2018-2019 Philippe Schmouker, Typee project, http://www.typee.ovh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 54e24b2

Please sign in to comment.