Skip to content

Commit 1545ac5

Browse files
committed
fixed markdown notation in RAP2
1 parent cb92574 commit 1545ac5

File tree

1 file changed

+18
-18
lines changed
  • courses/RascalAmendmentProposals/RAP2

1 file changed

+18
-18
lines changed

courses/RascalAmendmentProposals/RAP2/RAP2.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ sidebar_position: 2
1212

1313
## Abstract
1414

15-
The goal is to remove a number of features for calling parsers of different types and unify them in a single concept. **This concept is that any Rascal type represents a parser and we should be able to \`call\` this parser using a unified syntax.** We propose to not introduce new syntax at all, but to reuse the function call syntax. To parse using a Rascal type, the function name is represented by a reified type, like so:
15+
The goal is to remove a number of features for calling parsers of different types and unify them in a single concept. **This concept is that any Rascal type represents a parser and we should be able to `call` this parser using a unified syntax.** We propose to not introduce new syntax at all, but to reuse the function call syntax. To parse using a Rascal type, the function name is represented by a reified type, like so:
1616

17-
* \#int(“123”)
18-
* parses the string “123” to the integer \`123\`.
17+
* `#int(“123”)`
18+
* parses the string “123” to the integer `123`.
1919
* based on rascal expression parser or rascal-value parser
20-
* \#start\[CompilationUnit\](|home://myCprogram.c|)
20+
* `#start[CompilationUnit](|home://myCprogram.c|) `
2121
* uses the parser generated for C compilation units to parse a given C program in the given file.
2222
* Based on (data-dependent) Rascal-generated parser
2323

24-
Library functions like \`parse\` and \`readTextValueString\` will become deprecated after this feature has been added. Also the “as type” expression notation is redundant after this addition.
24+
Library functions like `parse` and `readTextValueString` will become deprecated after this feature has been added. Also the “as type” expression notation is redundant after this addition.
2525

2626
We will have fewer library functions and fewer expression syntaxes after this, without loss of functionality.
2727

28-
Parsing functions, as generated by types here, have parameters. The first and only positional parameter is what they will parse. The other parameters will be keyword parameters to provide options to the parse, such as \`allowAmbiguity\` and \`src\` and to provide contextual data to data-dependent parsers (when they are added).
28+
Parsing functions, as generated by types here, have parameters. The first and only positional parameter is what they will parse. The other parameters will be keyword parameters to provide options to the parse, such as `allowAmbiguity` and `src` and to provide contextual data to data-dependent parsers (when they are added).
2929

3030
## Motivation
3131

32-
* There are several ways of calling a parser right now in Rascal, none of them unique in terms of features, just different in syntax. It’s unnecessary. E.g. parse functions, read functions like readTextValueString, the \[AsType\] syntax, pattern matching. Is there more?
32+
* There are several ways of calling a parser right now in Rascal, none of them unique in terms of features, just different in syntax. It’s unnecessary. E.g. parse functions, read functions like readTextValueString, the [AsType] syntax, pattern matching. Is there more?
3333
* Each has its own syntax
3434
* Each has its own way of dealing with exceptions
3535
* Each has its own configurability
@@ -40,25 +40,25 @@ Parsing functions, as generated by types here, have parameters. The first and on
4040

4141
No new syntax is necessary for the new feature:
4242

43-
* syntax Expression \= Expression “(“ {Expression “,”}\* “)” // callOrTree exists already
44-
* syntax Expression \=\#” Type // type reification exists already
43+
* `syntax Expression \= Expression “(“ {Expression “,”}\* “)” // callOrTree exists already`
44+
* `syntax Expression \= “\#” Type // type reification exists already`
4545

4646
The new semantics is for the callOrTree syntax, statically we also allow these applications now:
4747

48-
* \<type\[\&T\] type\> ( loc input, bool allowAmbiguity \= false )
49-
* \<type\[\&T\] type\> ( str input, loc src \= |unknown:///|, bool allowAmbiguity \= false )
50-
* Both expressions return a value of type \`\&T\` (as instantiated) when successful, or they throw a syntaxError or a validationError exception value (see below)
48+
* `<type[&T] type> ( loc input, bool allowAmbiguity \= false ) `
49+
* `<type[&T] type> ( str input, loc src \= |unknown:///|, bool allowAmbiguity = false )`
50+
* Both expressions return a value of type `&T` (as instantiated) when successful, or they throw a syntaxError or a validationError exception value (see below)
5151

5252
Semantically, the parser which will be called switches on the kind of type and the kind of input:
5353

54-
* \[builtin, text\] For builtin types such as list, int, applied to a text file or string, the Rascal text value parser will be called;
55-
* \[builtin, bin\] For builtin types applied to a binary serialized file, the Rascal binary value parser will be called
56-
* \[data, text\] the Rascal text value parser will be called, and the value will be validated against the abstract syntax definition defined by the given reified type. Note that this gives rise to programmatically constructed abstract grammars which are used as parsers.
57-
* \[data, bin\] the Rascal binary value parser will be called and the result will be checked against the expected top-level type
58-
* \[syntax, text\]
54+
* [builtin, text] For builtin types such as list, int, applied to a text file or string, the Rascal text value parser will be called;
55+
* [builtin, bin] For builtin types applied to a binary serialized file, the Rascal binary value parser will be called
56+
* [data, text] the Rascal text value parser will be called, and the value will be validated against the abstract syntax definition defined by the given reified type. Note that this gives rise to programmatically constructed abstract grammars which are used as parsers.
57+
* [data, bin] the Rascal binary value parser will be called and the result will be checked against the expected top-level type
58+
* [syntax, text]
5959
* if the input does not start with “appl(” then a generated parser will be called to parse the text using the given non-terminal/grammar in the reified type
6060
* If the input is an already serialized parse tree, the code will use the values reader and validate if the top-type is indeed the expected non-terminal or throw a validation exception
61-
* \[syntax, bin\] the input is an already serialized parse tree in binary input, the code will use the values reader and validate if the top-type is indeed the expected non-terminal or throw a validation exception
61+
* [syntax, bin] the input is an already serialized parse tree in binary input, the code will use the values reader and validate if the top-type is indeed the expected non-terminal or throw a validation exception
6262

6363
Exceptions thrown by the new expression:
6464

0 commit comments

Comments
 (0)