diff options
Diffstat (limited to 'language-web/src/main/js/index.jsx')
-rw-r--r-- | language-web/src/main/js/index.jsx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/language-web/src/main/js/index.jsx b/language-web/src/main/js/index.jsx new file mode 100644 index 00000000..48c0baeb --- /dev/null +++ b/language-web/src/main/js/index.jsx | |||
@@ -0,0 +1,43 @@ | |||
1 | import React from 'react'; | ||
2 | import { render } from 'react-dom'; | ||
3 | |||
4 | import XtextCodeMirror from "./components/XtextCodeMirror"; | ||
5 | |||
6 | import '../css/index.scss'; | ||
7 | |||
8 | const initialValue = `class Family { | ||
9 | contains Person[] members | ||
10 | } | ||
11 | |||
12 | class Person { | ||
13 | Person[] children opposite parent | ||
14 | Person[0..1] parent opposite children | ||
15 | int age | ||
16 | TaxStatus taxStatus | ||
17 | } | ||
18 | |||
19 | enum TaxStatus { | ||
20 | child, student, adult, retired | ||
21 | } | ||
22 | |||
23 | % A child cannot have any dependents. | ||
24 | error invalidTaxStatus(Person p) :- | ||
25 | taxStatus(p, child), children(p, _q). | ||
26 | |||
27 | Family('family'). | ||
28 | members('family', anne). | ||
29 | members('family', bob). | ||
30 | members('family', ciri). | ||
31 | children(anne, ciri). | ||
32 | ?children(bob, ciri). | ||
33 | taxStatus(anne, adult). | ||
34 | age(anne, 35). | ||
35 | bobAge: 27. | ||
36 | age(bob, bobAge). | ||
37 | !age(ciri, bobAge). | ||
38 | |||
39 | scope Family = 1, Person += 5..10. | ||
40 | `; | ||
41 | const app = <XtextCodeMirror initialValue={initialValue}/>; | ||
42 | |||
43 | render(app, document.getElementById('app')); | ||