1- > module Introduction.Introduction where
2- >
3- > message = " Greetings!"
4-
5- About this tutorial
1+ About this book
62======================================================================
73
84You've arrived at **Learn You a Physics for Great Good**,
95the #1 stop for all your beginner-to-intermediate needs of learning
10- **Physics** through the use of **Domain Specifc Languages**
11- (hereinafter DSLs (mostly but not always) ).
6+ **Physics** through the use of **Domain Specific Languages**
7+ (DSLs).
128
13- This book was written as a [bachelor's thesis
9+ This book was written as a [BSc thesis
1410project](https://github.com/DSLsofMath/BScProj2018) at Chalmers
1511University of Technology as an offshoot of a bachelor's level elective
1612course [*Domain Specific Languages of
1713Mathematics*](https://github.com/DSLsofMath/DSLsofMath). The goal of
18- the the project and the reason for the existance of this book, is to
19- help primarily CS students learn physics better. We think that the use
14+ the the project and the reason for the existence of this book, is to
15+ help ( primarily CS) students learn physics better. We think that the use
2016of domain specific languages to teach the subject will help set these
2117students in the right mindset to learn physics efficiently and
2218properly. An observed problem has been that students base their mental
@@ -33,9 +29,9 @@ relief in between all the dramatic definitions.
3329
3430In this book, we will study physics through the lens of DSLs. We will
3531need to pay close attention to definitions, throughly ponder any
36- non-trivial syntax, and prove that the things we do are actually
37- correct. The areas covered include such things as: dimensional
38- analysis, vectors, calculus, and more!
32+ non-trivial syntax, and verify (via tests or proofs) that the things
33+ we do are actually correct. The areas covered include such things as:
34+ dimensional analysis, vectors, calculus, and more!
3935
4036The book is aimed at you who have some knowledge of
4137[Haskell](https://www.haskell.org/). If you know what a `class` and an
@@ -51,13 +47,13 @@ In general, a domain specific language is simply a computer language
5147for a specific domain. It's NOT a synonym for
5248[jargon](http://www.catb.org/jargon/html/online-preface.html)! DSLs
5349can be specialized for markup, like
54- [*HTML*](https://en.wikipedia.org/wiki/HTML); for modeling , like
50+ [*HTML*](https://en.wikipedia.org/wiki/HTML); for modelling , like
5551[*EBNF*](https://en.wikipedia.org/wiki/Extended_Backus% E2%80%93Naur_form);
56- for programming , like
52+ for shell scripting , like
5753[*Bash*](https://en.wikipedia.org/wiki/Bash_% 28Unix_shell%29); and
5854more.
5955
60- The languages we will construct will mostly concern modeling of
56+ The languages we will construct will mostly concern modelling of
6157physics and mathematics. We will create data structures in Haskell to
6258represent the same physics calculations that we write on paper, in
6359such a way that we can write functions to, for example, analyze the
@@ -72,15 +68,15 @@ $$x + x$$
7268
7369$$ x$$
7470
75- $$ x + x + x + x$$
71+ $$ ( x + x) + ( x + x) $$
7672
77- When implementing a DSL, we typically start with modeling the
78- syntax. Let's first declara a data type for the language
73+ When implementing a DSL, we typically start with modelling the
74+ syntax. Let's first declare a data type for the language
7975
8076> data Expr
8177
8278Then we interpret the textual description of the language. "Our
83- language will consist expressions of a single variable and
79+ language will consist of expressions of a single variable and
8480addition". Ok, so an expression can be one of two things then: a
8581single variable
8682
@@ -90,14 +86,15 @@ or two expressions added together.
9086
9187> | Add Expr Expr
9288
93- And that's it, kind of! A DSL without any associated functions for
94- validation, symbolic manipulation, evaluation, or somesuch, is really
95- no DSL at all! We must DO something with it, or there is no point!
89+ And that's it, kind of! However, a DSL without any associated
90+ functions for validation, symbolic manipulation, evaluation, or
91+ somesuch, is really no DSL at all! We must DO something with it, or
92+ there is no point!
9693
9794One thing we can do with expressions such as these, is compare whether
9895two of them are equal. Even without using any numbers, we can test
9996this by simply counting the $ x$ s! If both expressions contain the same
100- amount of $ x$ s, they will be equal!
97+ number of $ x$ s, they will be equal!
10198
10299> eq :: Expr -> Expr -> Bool
103100> eq e1 e2 = count e1 == count e2
@@ -110,7 +107,7 @@ We can now test whether our expressions are equal.
110107< True
111108
112109And NOW that's it (if we want to stop here)! This is a completely
113- valid (but boring) DSL. We've modeled the syntax, and added a function
110+ valid (but boring) DSL. We've modelled the syntax, and added a function
114111that operates symbolically on our language. This is a very small and
115112simple DSL, and you've likely done something similar before without
116113even realizing you were constructing a DSL. It can really be that
@@ -131,7 +128,7 @@ What you need to dive in
131128======================================================================
132129
133130To just follow along and implement the same stuff we do, a single
134- document loaded into GHCI will do. For this, you just need to install the
131+ document loaded into GHCi will do. For this, you just need to install the
135132[Haskell Platform](https://www.haskell.org/platform/).
136133
137134If you want to automatically install any required dependencies, like
@@ -143,7 +140,7 @@ what you'll need. With Stack installed and [our repository
143140cloned](https://github.com/DSLsofMath/BScProj2018), enter the
144141`Physics` directory and type `stack build`. Stack should now download
145142and compile all necessary dependencies, such that they are avaiable
146- when you load a module in GHCI .
143+ when you load a module in GHCi .
147144
148145
149146
@@ -158,7 +155,7 @@ attention.
158155If you still don't really get what DSLs are all about, try reading the
159156["notes" (almost a full book really) for the course on DSLs of math at
160157Chalmers](https://github.com/DSLsofMath/DSLsofMath/tree/master/L/snapshots). If
161- you're studying at Chalmers, even better to actually take the course!
158+ you're studying at Chalmers, it is even better to actually take the course!
162159
163160If there's some part of the material that you still think is unclear
164161(or maybe even wrong? Blasphemy!), please [open an issue on the github
0 commit comments