diff --git a/public/img/desc_thp_2.jpg b/public/img/desc_thp_2.jpg new file mode 100644 index 0000000..cc8c0f6 Binary files /dev/null and b/public/img/desc_thp_2.jpg differ diff --git a/src/pages/en/v0.0.1/learn/index.mdx b/src/pages/en/v0.0.1/learn/index.mdx index 8614a33..5d2e99a 100644 --- a/src/pages/en/v0.0.1/learn/index.mdx +++ b/src/pages/en/v0.0.1/learn/index.mdx @@ -13,7 +13,7 @@ Welcome to the documentation of the THP programming languague. THP ~~is~~ will be a new programming language that compiles to PHP. -![Accurate visual description of THP](/img/desc_thp.jpg) +![Accurate visual description of THP](/img/desc_thp_2.jpg) ## Compiler rewrite diff --git a/src/pages/en/v0.0.1/spec/index.mdx b/src/pages/en/v0.0.1/spec/index.mdx index 7692f83..db81dec 100644 --- a/src/pages/en/v0.0.1/spec/index.mdx +++ b/src/pages/en/v0.0.1/spec/index.mdx @@ -322,6 +322,23 @@ RightBrace = "}" On this section of the grammar plain strings are used instead of keywords productions. +### Source file & modules + +Each THP source file is a module. + +```ebnf +Module = Statement* +``` + +### Statement + +For now there is only 1 type of statement. + +```ebnf +Statement = VariableBinding +``` + + ### Variable binding Variable bindings have 2 forms: immutable & mutable. @@ -337,6 +354,8 @@ can be dropped. Mutable bindings cannot drop the var keyword. ```ebnf +VariableBinding = ImmutableBinding | MutableBinding + ImmutableBinding = "val", Datatype?, Identifier, "=", Expression | Datatype, Identifier, "=", Expression @@ -345,6 +364,11 @@ MutableBinding = "var", Datatype?, Identifier, "=", Expression ### Expression +For now, the only expression recognized is a number. + +```ebnf +Expression = Number +```