Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full Rust language grammar definition to docs #19353

Merged
merged 2 commits into from Jan 20, 2015

Conversation

@icorderi
Copy link
Contributor

icorderi commented Nov 27, 2014

Original issue that inspired this patch.

The reference.md has evolved past simple grammatical constructs, and it serves a different purpose.
The intent for the proposed grammar.md is to hold only the official reference for the language grammar. This document would keep track of grammatical changes to the language over time, facilitate discussions over proposed changes to the existing grammar, and serve as basis for building parsers by third-parties (IDE's, GitHub linguist, CodeMirror, etc.).

The current state of the PR contains all the grammars that were available in reference.md and nothing else.
There are still a lot of missing pieces that weren't available. The following are just a few of the definitions missing:

We need help from people familiar with those grammatical constructs to fill in the missing pieces.

@rust-highfive
Copy link
Collaborator

rust-highfive commented Nov 27, 2014

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.


### Functions

**FIXME:** grammar?

This comment has been minimized.

Copy link
@P1start

P1start Nov 29, 2014

Contributor

I think something like this might work:

fn_decl: "pub"? "unsafe"? ("extern" string_lit?)? "fn" ident ('<' generics '>')? where_clause? '(' arg-list ')' ("->" (type | '!'))? '{' stmt* expr? '}';

(arg-list is defined later in the Closure types section.) Note that functions inside extern blocks have a slightly different grammar:

extern_fn_decl: "pub"? "fn" ident '(' extern_arg_list ')' ("->" (type | '!'))? ';';
extern_arg_list: ident ':' type | ident ':' type ',' "..." | ident ':' type ',' extern_arg_list;

And, furthermore, functions inside trait definitions can have their argument names and/or body omitted, cannot be declared pub, can have self parameters, and have the order of extern and unsafe switched around (#19398):

trait_fn_decl: ("extern" string_lit?)? "unsafe"? "fn" ident ('<' generics '>')? where_clause? '(' trait_arg_list ')' ("->" (type | '!'))? ('{' stmt* expr? '}' | ';');
trait_arg_list: (ident ':')? type | (`&` lifetime)? "mut"? "self" (',' trait_arg_list)? | (ident ':')? type ',' trait_arg_list;

Trait implementations are similar, but cannot have their body or parameter names omitted:

impl_fn_decl: ("extern" string_lit?)? "unsafe"? "fn" ident ('<' generics '>')? where_clause? '(' trait_arg_list ')' ("->" (type | '!'))? '{' stmt* expr? '}';
impl_arg_list: ident ':' type | (`&` lifetime)? "mut"? "self" (',' impl_arg_list)? | ident ':' type ',' impl_arg_list;

I think I’ve handled most things here, but I’m sure I’ve forgotten something. Functions are pretty complicated!

@P1start
Copy link
Contributor

P1start commented Nov 29, 2014

There are a few inconsistencies here:

  • Sometimes [ foo ] is used for grouping, sometimes ( foo ) is, and sometimes [ foo ] is used to denote foo being optional;
  • Some names use underscores, and some use hyphens;
  • Sometimes := is used to define rules, and sometimes : is.
@icorderi
Copy link
Contributor Author

icorderi commented Nov 29, 2014

@P1start I think styling issues might be just due to different people writing pieces of it. They are all valid on some grammar notation or another. The entire documents was copied from the reference.md.
For what is worth, we do need consistency on the rules and the documents starts with a grammar for the grammars, which appears to be a slight modification over EBNF syntax.

grammar : rule + ;
rule    : nonterminal ':' productionrule ';' ;
productionrule : production [ '|' production ] * ;
production : term * ;
term : element repeats ;
element : LITERAL | IDENTIFIER | '[' productionrule ']' ;
repeats : [ '*' | '+' ] NUMBER ? | NUMBER ? | '?' ;

Where:

  • Whitespace in the grammar is ignored.
  • Square brackets are used to group rules.
  • LITERAL is a single printable ASCII character, or an escaped hexadecimal ASCII > code of the form \xQQ, in single quotes, denoting the corresponding Unicode codepoint U+00QQ.
  • IDENTIFIER is a nonempty string of ASCII letters and underscores.
  • The repeat forms apply to the adjacent element, and are as follows:
    • ? means zero or one repetition
    • * means zero or more repetitions
    • + means one or more repetitions
  • NUMBER trailing a repeat symbol gives a maximum repetition count
  • NUMBER on its own gives an exact repetition count
    This EBNF dialect should hopefully be familiar to many readers.

Based on that ( foo ) doesn't seems to be part of the grammar.

Personally I prefer defining the grammar with ::= or := for productions. It's an extra key stroke but it makes the rule easier to read, at least to me.

In any case it seems we have to:
0. (pick a grammar...)

  1. clean up the existing productions to make them consistent with the grammar we will be using to define them.
  2. Complete the missing sections

The questions now is whether we do this collaboration against my fork or we merge this and do it against rust-lang. I don't know how you guys generally handle WIP from multiple sources.

@nodakai
Copy link
Contributor

nodakai commented Dec 2, 2014

This is a great step towards a matured programming language! Let me see how I can contribute to it.

I made some remarks on string/char literals with newline characters at #19399 . Hope this helps.

@steveklabnik
Copy link
Member

steveklabnik commented Dec 18, 2014

I wonder at what point this is good to just land, and fill them in as we go, rather than let this sit here.

@shepmaster
Copy link
Member

shepmaster commented Dec 18, 2014

Should the grammar sections in the Reference be removed, so they don't go (more) stale?

@icorderi
Copy link
Contributor Author

icorderi commented Dec 18, 2014

@steveklabnik agreed. We should not wait for this to be complete to merge.

@shepmaster, I'm not sure how much having the formal grammar on the reference helps the reader. If this document makes it in and becomes the goto place for the rust grammar then the reference should not have grammar definitions. We can simply leave links on the reference.md to the corresponding grammar on each section in case the reader wants to take a look.

@steveklabnik
Copy link
Member

steveklabnik commented Dec 18, 2014

Well, the idea is that the reference is a borderline-language spec, so having the grammar in it is useful. But until we have a full grammar, it doesn't make sense to have part of it there and the rest in this document. We should pull the grammar out of the reference and then link to this instead.

@Gankra
Copy link
Contributor

Gankra commented Jan 2, 2015

Triage bump

@emberian
Copy link
Member

emberian commented Jan 5, 2015

My basic feeling is that none of the old grammar is worth keeping and we should instead, if we want, distribute a grammar as a separate appendix.

@steveklabnik

This comment has been minimized.

Copy link

steveklabnik commented on ab24ffe Jan 12, 2015

r+ rollup

This comment has been minimized.

Copy link

steveklabnik replied Jan 14, 2015

p=1

This comment has been minimized.

Copy link

steveklabnik replied Jan 14, 2015

let's get this rollup going

This comment has been minimized.

Copy link

steveklabnik replied Jan 14, 2015

@bors: retry

This comment has been minimized.

Copy link

steveklabnik replied Jan 15, 2015

@bors: retry

This comment has been minimized.

Copy link

steveklabnik replied Jan 15, 2015

@bors: retry

This comment has been minimized.

Copy link

steveklabnik replied Jan 16, 2015

@bors: retry

This comment has been minimized.

Copy link

steveklabnik replied Jan 17, 2015

@bors: retry

@steveklabnik
Copy link
Member

steveklabnik commented Jan 12, 2015

I'm going to merge this as-is, and we can keep improving it, including the part about adding links from the reference. Thank you!

@bors

This comment has been minimized.

Copy link
Contributor

bors commented on ab24ffe Jan 14, 2015

saw approval from steveklabnik
at icorderi@ab24ffe

This comment has been minimized.

Copy link
Contributor

bors replied Jan 14, 2015

merging 43 batched pull requests into batch

This comment has been minimized.

Copy link
Contributor

bors replied Jan 14, 2015

status: {"merge_sha": "f32581ebb8b809e55cb4e61ac1c5f7a6a546c930", "rollup_pulls": [[19353, "ab24ffe21a742287ee12d5992d4c90e83abb374d"], [20463, "9f5fc563d3d592d5e44ab71759ffa26d326b3daa"], [20632, "4b14f67df3c28cd1cd8ea5bf794a3e542c663d8d"], [20892, "9302dc5d9e13f716a21a5d9ebdcddc149a864b19"], [20929, "eabf2082856668c75ed6f7c229b24fb7755440bc"], [20964, "78b7e13bf02e59ad05a9d15725e3c36e9dcf7187"], [20976, "415fc5f0f10b6180193ecd309b21ae80a1efa6a9"], [20985, "11737a3e1d5080c10f1ca366a12cf8fed7941d49"], [20986, "a3d87fa448de23d9d2faaf6f68803e5925653244"], [20988, "8eba032f52a0b16b39a94267b4884f361e022c36"], [20991, "7e8453566ed15434e7bc19f52ee78ee6d67a4167"], [21001, "e1ff480e433697ae546e2cedebf659dc1b19572f"], [21004, "2ef25dee5fa5ef42e9b9d7d88492c9f3c9f845fd"], [21005, "933303413e4fe97dbfd7e7f0a6f26dfb077696e8"], [21011, "ba9e223c57de82fbdb4da1446de570e028477aec"], [21013, "c403794310814d2d83e80f2f10308195505b48be"], [21014, "285277dd804e8e380dde764a00c97a721b4ef976"], [21015, "be407180d726f0121ccce9a7439f14de1731435c"], [21020, "e485d297ea6e882725c3d5b510183a3f8d816530"], [21023, "95f9e309f7307ace9218307f943f29662e21a1e5"], [21026, "55cc82475786127583f0f975a2e8fe2a741544ac"], [21028, "425f449fdacb72f98a3e7c4326997b09b9b9a127"], [21029, "b704983ee925dff219ecc5b8e7dd2ba9fec64c1f"], [21031, "db7de969cfb50587475185e25bd09b7e73cafe83"], [21036, "d6e67e938bfce049432b3084787c055911b76f5c"], [21038, "2297b0cb0028965a2ef1d6a5de3d4c2dbe172825"], [21040, "16a8c4d2382d72aa414d89192422187acd290270"], [21041, "d7999d4041875ad4e9d16f400342301ee2eab081"], [21046, "599232503a7959faafa21bc8b38ca98f4b28e536"], [21054, "71884601f955c67b055fad8351074eae4f849769"], [21059, "6a7f0a99d8005187736c3c26c5cc2d538a42590f"], [21066, "323abc0eb0e99d445a38aa4fc0da93f5791ff492"], [21071, "9af8a646a964985fe42a91ea34672266c91ae295"], [21075, "31ac1fb93df9b9a2db332f055052dbfb779bdf91"], [21103, "1217007c8335ec2b3097583ff3e0ad15a35af26e"], [21109, "ad0ce88c6cceec7a5cc3efc91b9447b05fd578a1"], [21120, "6cfbcca41e259ddf93fb86a54e8d5f5bbcd3e6f1"], [21124, "40219249cf87585023e0d1b44de261dd56752142"]]}

This comment has been minimized.

Copy link
Contributor

bors replied Jan 14, 2015

Testing rollup candidate = f32581e

Successful merges:

  • #19353 Add full Rust language grammar definition to docs (icorderi/docs/grammar = ab24ffe)
  • #20463 Return passed value from black_box (amaranth/black_box_output = 9f5fc56)
  • #20632 Replace usage of deriving with derive in docs (gchp/reference = 4b14f67)
  • #20892 Replace uint with u32 in trpl/guessing-game.md (CarVac/master = 9302dc5)
  • #20929 Ease parsing of an English sentence (laurilehmijoki/master = eabf208)
  • #20964 Fix attr syntax in recursion limit diagnostic (sfackler/recursion-syntax = 78b7e13)
  • #20976 Remove unused import. (jbcrail/rm-unused-import = 415fc5f)
  • #20985 iOS: fixed install phase (vhbit/ios-install = 11737a3)
  • #20986 Doc fixes (alkor/doc-fixes = a3d87fa)
  • #20988 Purge references to Rust tasks from TRPL. (ciphergoth/task-to-thread = 8eba032)
  • #20991 Redo Segmented stack support for DragonFly (mneumann/llvm-dragonfly-take2 = 7e84535)
  • #21001 Remove usage and reference of feature(globs) from the book (camjackson/master = e1ff480)
  • #21004 Update reference: change int/uint by isize/usize (ctrompette/rename-int-uint-to-isize-usize = 2ef25de)
  • #21005 Update #[deriving] documentation. (huonw/deriving-docs = 9333034)
  • #21011 Small grammar fix in the book (steveklabnik/gh20993 = ba9e223)
  • #21013 Small fix in the book (steveklabnik/gh20914 = c403794)
  • #21014 Clean up unary operators in the reference (steveklabnik/gh20876 = 285277d)
  • #21015 Link to sections in the book's README.md (steveklabnik/gh20852 = be40718)
  • #21020 Improve example in the intro. (steveklabnik/gh20844 = e485d29)
  • #21023 Clean up wording around uninitialized values. (steveklabnik/gh20840 = 95f9e30)
  • #21026 Add note about libc::exit's unsafety. (steveklabnik/gh19245 = 55cc824)
  • #21028 Remove PDF link on 404 page (steveklabnik/gh17368 = 425f449)
  • #21029 Improve the ownership guide a tad (steveklabnik/gh19924 = b704983)
  • #21031 Improve clarity of paragraph in the pointer guide (steveklabnik/gh19067 = db7de96)
  • #21036 Vec's IntoIter should be Send/Sync when Vec is (renato-zannon/into-iter-impls = d6e67e9)
  • #21038 Elaborate on destructuring let (steveklabnik/gh20471 = 2297b0c)
  • #21040 Don't use 'synonym' with regards to newtypes (steveklabnik/gh20037 = 16a8c4d)
  • #21041 Add explanation of main to rustdoc docs (steveklabnik/gh17554 = d7999d4)
  • #21046 Windows building fixes (steveklabnik/gh16654 = 5992325)
  • #21054 Remove dead link from make tips (steveklabnik/gh17950 = 7188460)
  • #21059 Add note about TLS lookups in random() (steveklabnik/gh16072 = 6a7f0a9)
  • #21066 add test for issue #20575 (japaric/issue-20575 = 323abc0)
  • #21071 make the book more mobile friendly (sfaxon/mobile-friendly-book = 9af8a64)
  • #21075 Various changes to Rust Introduction (iKevinY/intro-changes = 31ac1fb)
  • #21103 Fix a typo and use if-let instead of match in std::result docs (nagisa/result-typo = 1217007)
  • #21109 Provide example of generic inverse() (steveklabnik/gh17224 = ad0ce88)
  • #21120 Issue model lexer questionmark (fhahn/issue-model-lexer-questionmark = 6cfbcca)
  • #21124 Re-direct to the right place. (steveklabnik/fix_redirect = 4021924)

Failed merges:

  • #20998 s/deriving/derives in Comments/Docs (estsauver/20984 = 7e472ef)
  • #21030 Remove segmented stack info from the FFI chapter of the book. (steveklabnik/gh20071 = f8305a2)
  • #21050 Evaluate # fn in docs (steveklabnik/gh13423 = 860afcb)
  • #21096 Intpocalypse, book edition. (steveklabnik/intpocalypse = 45e01b4)
  • #21105 Remove unneeded box import in examples (csouth3/kill-box-import = 07f723f)

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

saw approval from steveklabnik
at icorderi@ab24ffe

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

merging 6 batched pull requests into batch

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

status: {"merge_sha": "2a243da468a66117c6a513b35bff876fca2335ac", "rollup_pulls": [[19353, "ab24ffe21a742287ee12d5992d4c90e83abb374d"], [21294, "8da284a045c4d59a850f63fe9a11ab7ddb38ef17"], [21302, "35d46fabaf63c0b1b607bd91cd5680eeaa2f9a14"], [21314, "5aa2f9c651546d420c8da551b3d95849f4ade310"], [21326, "ac4baca72a392bf683d513e5cd3aa00b01f5e7a8"], [21336, "b6b8880f0ec3f057dc56320f6886be173a8f0d8e"]]}

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

Testing rollup candidate = 2a243da

Successful merges:

  • #19353 Add full Rust language grammar definition to docs (icorderi/docs/grammar = ab24ffe)
  • #21294 docs: typo (alfie/typo = 8da284a)
  • #21302 remove test_find_equiv, since find_equiv doesn't exist anymore (gutworth/rm-find-equiv-test = 35d46fa)
  • #21314 Use singular they in the serialize::json docs (fenhl/patch-1 = 5aa2f9c)
  • #21326 Passable nano syntax highlighting (look/nano-syntax-highlighting = ac4baca)
  • #21336 Improve the error message when source file cannot be read (rylev/better-nofile-error = b6b8880)
bors added a commit that referenced this pull request Jan 14, 2015
Add full Rust language grammar definition to docs

Reviewed-by: steveklabnik
@bors

This comment has been minimized.

Copy link
Contributor

bors commented on ab24ffe Jan 14, 2015

saw approval from steveklabnik
at icorderi@ab24ffe

This comment has been minimized.

Copy link
Contributor

bors replied Jan 14, 2015

merging 43 batched pull requests into batch

This comment has been minimized.

Copy link
Contributor

bors replied Jan 14, 2015

status: {"merge_sha": "f32581ebb8b809e55cb4e61ac1c5f7a6a546c930", "rollup_pulls": [[19353, "ab24ffe21a742287ee12d5992d4c90e83abb374d"], [20463, "9f5fc563d3d592d5e44ab71759ffa26d326b3daa"], [20632, "4b14f67df3c28cd1cd8ea5bf794a3e542c663d8d"], [20892, "9302dc5d9e13f716a21a5d9ebdcddc149a864b19"], [20929, "eabf2082856668c75ed6f7c229b24fb7755440bc"], [20964, "78b7e13bf02e59ad05a9d15725e3c36e9dcf7187"], [20976, "415fc5f0f10b6180193ecd309b21ae80a1efa6a9"], [20985, "11737a3e1d5080c10f1ca366a12cf8fed7941d49"], [20986, "a3d87fa448de23d9d2faaf6f68803e5925653244"], [20988, "8eba032f52a0b16b39a94267b4884f361e022c36"], [20991, "7e8453566ed15434e7bc19f52ee78ee6d67a4167"], [21001, "e1ff480e433697ae546e2cedebf659dc1b19572f"], [21004, "2ef25dee5fa5ef42e9b9d7d88492c9f3c9f845fd"], [21005, "933303413e4fe97dbfd7e7f0a6f26dfb077696e8"], [21011, "ba9e223c57de82fbdb4da1446de570e028477aec"], [21013, "c403794310814d2d83e80f2f10308195505b48be"], [21014, "285277dd804e8e380dde764a00c97a721b4ef976"], [21015, "be407180d726f0121ccce9a7439f14de1731435c"], [21020, "e485d297ea6e882725c3d5b510183a3f8d816530"], [21023, "95f9e309f7307ace9218307f943f29662e21a1e5"], [21026, "55cc82475786127583f0f975a2e8fe2a741544ac"], [21028, "425f449fdacb72f98a3e7c4326997b09b9b9a127"], [21029, "b704983ee925dff219ecc5b8e7dd2ba9fec64c1f"], [21031, "db7de969cfb50587475185e25bd09b7e73cafe83"], [21036, "d6e67e938bfce049432b3084787c055911b76f5c"], [21038, "2297b0cb0028965a2ef1d6a5de3d4c2dbe172825"], [21040, "16a8c4d2382d72aa414d89192422187acd290270"], [21041, "d7999d4041875ad4e9d16f400342301ee2eab081"], [21046, "599232503a7959faafa21bc8b38ca98f4b28e536"], [21054, "71884601f955c67b055fad8351074eae4f849769"], [21059, "6a7f0a99d8005187736c3c26c5cc2d538a42590f"], [21066, "323abc0eb0e99d445a38aa4fc0da93f5791ff492"], [21071, "9af8a646a964985fe42a91ea34672266c91ae295"], [21075, "31ac1fb93df9b9a2db332f055052dbfb779bdf91"], [21103, "1217007c8335ec2b3097583ff3e0ad15a35af26e"], [21109, "ad0ce88c6cceec7a5cc3efc91b9447b05fd578a1"], [21120, "6cfbcca41e259ddf93fb86a54e8d5f5bbcd3e6f1"], [21124, "40219249cf87585023e0d1b44de261dd56752142"]]}

This comment has been minimized.

Copy link
Contributor

bors replied Jan 14, 2015

Testing rollup candidate = f32581e

Successful merges:

  • #19353 Add full Rust language grammar definition to docs (icorderi/docs/grammar = ab24ffe)
  • #20463 Return passed value from black_box (amaranth/black_box_output = 9f5fc56)
  • #20632 Replace usage of deriving with derive in docs (gchp/reference = 4b14f67)
  • #20892 Replace uint with u32 in trpl/guessing-game.md (CarVac/master = 9302dc5)
  • #20929 Ease parsing of an English sentence (laurilehmijoki/master = eabf208)
  • #20964 Fix attr syntax in recursion limit diagnostic (sfackler/recursion-syntax = 78b7e13)
  • #20976 Remove unused import. (jbcrail/rm-unused-import = 415fc5f)
  • #20985 iOS: fixed install phase (vhbit/ios-install = 11737a3)
  • #20986 Doc fixes (alkor/doc-fixes = a3d87fa)
  • #20988 Purge references to Rust tasks from TRPL. (ciphergoth/task-to-thread = 8eba032)
  • #20991 Redo Segmented stack support for DragonFly (mneumann/llvm-dragonfly-take2 = 7e84535)
  • #21001 Remove usage and reference of feature(globs) from the book (camjackson/master = e1ff480)
  • #21004 Update reference: change int/uint by isize/usize (ctrompette/rename-int-uint-to-isize-usize = 2ef25de)
  • #21005 Update #[deriving] documentation. (huonw/deriving-docs = 9333034)
  • #21011 Small grammar fix in the book (steveklabnik/gh20993 = ba9e223)
  • #21013 Small fix in the book (steveklabnik/gh20914 = c403794)
  • #21014 Clean up unary operators in the reference (steveklabnik/gh20876 = 285277d)
  • #21015 Link to sections in the book's README.md (steveklabnik/gh20852 = be40718)
  • #21020 Improve example in the intro. (steveklabnik/gh20844 = e485d29)
  • #21023 Clean up wording around uninitialized values. (steveklabnik/gh20840 = 95f9e30)
  • #21026 Add note about libc::exit's unsafety. (steveklabnik/gh19245 = 55cc824)
  • #21028 Remove PDF link on 404 page (steveklabnik/gh17368 = 425f449)
  • #21029 Improve the ownership guide a tad (steveklabnik/gh19924 = b704983)
  • #21031 Improve clarity of paragraph in the pointer guide (steveklabnik/gh19067 = db7de96)
  • #21036 Vec's IntoIter should be Send/Sync when Vec is (renato-zannon/into-iter-impls = d6e67e9)
  • #21038 Elaborate on destructuring let (steveklabnik/gh20471 = 2297b0c)
  • #21040 Don't use 'synonym' with regards to newtypes (steveklabnik/gh20037 = 16a8c4d)
  • #21041 Add explanation of main to rustdoc docs (steveklabnik/gh17554 = d7999d4)
  • #21046 Windows building fixes (steveklabnik/gh16654 = 5992325)
  • #21054 Remove dead link from make tips (steveklabnik/gh17950 = 7188460)
  • #21059 Add note about TLS lookups in random() (steveklabnik/gh16072 = 6a7f0a9)
  • #21066 add test for issue #20575 (japaric/issue-20575 = 323abc0)
  • #21071 make the book more mobile friendly (sfaxon/mobile-friendly-book = 9af8a64)
  • #21075 Various changes to Rust Introduction (iKevinY/intro-changes = 31ac1fb)
  • #21103 Fix a typo and use if-let instead of match in std::result docs (nagisa/result-typo = 1217007)
  • #21109 Provide example of generic inverse() (steveklabnik/gh17224 = ad0ce88)
  • #21120 Issue model lexer questionmark (fhahn/issue-model-lexer-questionmark = 6cfbcca)
  • #21124 Re-direct to the right place. (steveklabnik/fix_redirect = 4021924)

Failed merges:

  • #20998 s/deriving/derives in Comments/Docs (estsauver/20984 = 7e472ef)
  • #21030 Remove segmented stack info from the FFI chapter of the book. (steveklabnik/gh20071 = f8305a2)
  • #21050 Evaluate # fn in docs (steveklabnik/gh13423 = 860afcb)
  • #21096 Intpocalypse, book edition. (steveklabnik/intpocalypse = 45e01b4)
  • #21105 Remove unneeded box import in examples (csouth3/kill-box-import = 07f723f)

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

saw approval from steveklabnik
at icorderi@ab24ffe

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

merging 6 batched pull requests into batch

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

status: {"merge_sha": "2a243da468a66117c6a513b35bff876fca2335ac", "rollup_pulls": [[19353, "ab24ffe21a742287ee12d5992d4c90e83abb374d"], [21294, "8da284a045c4d59a850f63fe9a11ab7ddb38ef17"], [21302, "35d46fabaf63c0b1b607bd91cd5680eeaa2f9a14"], [21314, "5aa2f9c651546d420c8da551b3d95849f4ade310"], [21326, "ac4baca72a392bf683d513e5cd3aa00b01f5e7a8"], [21336, "b6b8880f0ec3f057dc56320f6886be173a8f0d8e"]]}

This comment has been minimized.

Copy link
Contributor

bors replied Jan 18, 2015

Testing rollup candidate = 2a243da

Successful merges:

  • #19353 Add full Rust language grammar definition to docs (icorderi/docs/grammar = ab24ffe)
  • #21294 docs: typo (alfie/typo = 8da284a)
  • #21302 remove test_find_equiv, since find_equiv doesn't exist anymore (gutworth/rm-find-equiv-test = 35d46fa)
  • #21314 Use singular they in the serialize::json docs (fenhl/patch-1 = 5aa2f9c)
  • #21326 Passable nano syntax highlighting (look/nano-syntax-highlighting = ac4baca)
  • #21336 Improve the error message when source file cannot be read (rylev/better-nofile-error = b6b8880)
bors added a commit that referenced this pull request Jan 14, 2015
Add full Rust language grammar definition to docs

Reviewed-by: steveklabnik
@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jan 15, 2015

I think if we're going to distribute an official grammar, we really ought to have an automated testing mechanism. Not to say r- on this patch, just that this should be a priority. I think it'd be very helpful, personally, even if it's not what the actual rustc uses (and even if we don't check for correspondence between rustc and the official grammar, which of course would also be good).

@steveklabnik
Copy link
Member

steveklabnik commented Jan 15, 2015

@nikomatsakis we had some of this in src/grammar, but yes, such a thing would be nice.

@steveklabnik
Copy link
Member

steveklabnik commented Jan 15, 2015

Oh also, this isn't currently linked from anywhere yet, so while it's kind of official, people may not actually know about it 😉 maybe that's a good critiera for when to add the link.

bors added a commit that referenced this pull request Jan 15, 2015
Add full Rust language grammar definition to docs

Reviewed-by: steveklabnik
@emberian
Copy link
Member

emberian commented Jan 15, 2015

I also really think that this particular partial grammar is worthless, but we can replace it later with https://github.com/bleibig/rust-grammar or https://github.com/ptgreen/rfront as the need arises.

bors added a commit that referenced this pull request Jan 15, 2015
Add full Rust language grammar definition to docs

Reviewed-by: steveklabnik
bors added a commit that referenced this pull request Jan 15, 2015
Add full Rust language grammar definition to docs

Reviewed-by: steveklabnik
bors added a commit that referenced this pull request Jan 16, 2015
Add full Rust language grammar definition to docs

Reviewed-by: steveklabnik
@steveklabnik steveklabnik mentioned this pull request Jan 16, 2015
bors added a commit that referenced this pull request Jan 17, 2015
bors added a commit that referenced this pull request Jan 18, 2015
Add full Rust language grammar definition to docs

Reviewed-by: steveklabnik
@steveklabnik
Copy link
Member

steveklabnik commented Jan 20, 2015

@bors
Copy link
Contributor

bors commented Jan 20, 2015

Testing commit ab24ffe with merge a0f86de...

bors added a commit that referenced this pull request Jan 20, 2015
Original [issue](#19278) that inspired this patch.

The [reference.md] has evolved past simple grammatical constructs, and it serves a different purpose. 
The intent for the proposed _grammar.md_ is to hold **only** the official reference for the language grammar. This document would keep track of grammatical changes to the language over time, facilitate discussions over proposed changes to the existing grammar, and serve as basis for building parsers by third-parties (IDE's, GitHub linguist, CodeMirror, etc.). 

The current state of the PR contains all the grammars that were available in [reference.md] and nothing else. 
There are still a lot of missing pieces that weren't available. The following are just a few of the definitions missing:
- [Functions](https://github.com/icorderi/rust/blob/docs/grammar/src/doc/grammar.md#functions)
- [Structures](https://github.com/icorderi/rust/blob/docs/grammar/src/doc/grammar.md#structures)
- [Traits](https://github.com/icorderi/rust/blob/docs/grammar/src/doc/grammar.md#traits)
- [Implementations](https://github.com/icorderi/rust/blob/docs/grammar/src/doc/grammar.md#implementations)
- [Operators](https://github.com/icorderi/rust/blob/docs/grammar/src/doc/grammar.md#unary-operator-expressions)
- [Statements](https://github.com/icorderi/rust/blob/docs/grammar/src/doc/grammar.md#statements)
- [Expressions](https://github.com/icorderi/rust/blob/docs/grammar/src/doc/grammar.md#expressions)

[reference.md]: https://github.com/rust-lang/rust/blob/master/src/doc/reference.md

We need help from people familiar with those grammatical constructs to fill in the missing pieces.
@bors bors merged commit ab24ffe into rust-lang:master Jan 20, 2015
2 of 3 checks passed
2 of 3 checks passed
default some tests failed
continuous-integration/travis-ci The Travis CI build passed
Details
homu Test successful
Details
@brson
Copy link
Contributor

brson commented Jan 27, 2015

Epic PR. Thanks for sticking with it.

@SimonSapin
Copy link
Contributor

SimonSapin commented Jan 28, 2015

Does this new document shows up somewhere on http://doc.rust-lang.org? I couldn’t find it.

@steveklabnik
Copy link
Member

steveklabnik commented Jan 28, 2015

@SimonSapin it does not yet, as it's not finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.