Skip to content

Commit

Permalink
Merge pull request #106 from Herb-AI/documentation-ast-pluto
Browse files Browse the repository at this point in the history
Documentation ast pluto
  • Loading branch information
pwochner authored Oct 3, 2024
2 parents 0a24af5 + 1849415 commit cf02c8e
Show file tree
Hide file tree
Showing 26 changed files with 5,431 additions and 4,972 deletions.
5 changes: 5 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
Herb = "c09c6b7f-4f63-49de-90d9-97a3563c0f4a"
HerbConstraints = "1fa96474-3206-4513-b4fa-23913f296dfc"
HerbCore = "2b23ba43-8213-43cb-b5ea-38c12b45bd45"
HerbData = "495a3ad3-8034-41b3-a087-aacf2fd71098"
HerbGrammar = "4ef9e186-2fe5-4b24-8de7-9f7291f24af7"
HerbInterpret = "5bbddadd-02c5-4713-84b8-97364418cca7"
HerbSearch = "3008d8e8-f9aa-438a-92ed-26e9c7b4829f"
HerbSpecification = "6d54aada-062f-46d8-85cf-a1ceaf058a06"
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
PlutoSliderServer = "2fc8631c-6f24-4c5b-bca7-cbb509c42db4"
PlutoStaticHTML = "359b1769-a58e-495b-9770-312e911026ad"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"

[compat]
Expand Down
33 changes: 23 additions & 10 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Documenter

using Pluto, PlutoSliderServer

using Herb

using HerbConstraints
Expand All @@ -9,18 +11,28 @@ using HerbInterpret
using HerbCore
using HerbSpecification

# Use jupyter.nbconver to convert notebooks to markdown
using PyCall
jupyter = pyimport("jupyterlab")
nbconvert = pyimport("nbconvert")
all_notebooks = readdir("docs/src/tutorials/")
for file in all_notebooks
if occursin("ipynb", file)
path = "docs/src/tutorials/" * file
run(`jupyter nbconvert --to markdown $path`)
# Create md file for tutorial that embeds html file
basedir = joinpath(@__DIR__, "src", "tutorials")
html_files = filter!(f -> occursin(r"\.html$", f), readdir(basedir)) # assumes all html file in directory are tutorials

for f in html_files
html_path = joinpath(basedir, f)
filename = replace(f, ".html" => "")
md_path = joinpath(basedir, "$filename.md")
content = """
# Tutorial $filename
<iframe src="$html_path" width="100%" height="600px"></iframe>
"""
open(md_path, "w") do file
write(
file,
content
)
end
end


makedocs(
modules=[HerbConstraints, HerbSearch, HerbGrammar, HerbSpecification, HerbInterpret, HerbCore],
authors="PONYs",
Expand All @@ -38,7 +50,8 @@ makedocs(
"Advanced Search Procedures" => "tutorials/advanced_search.md",
"Top Down Iterator" => "tutorials/TopDown.md",
"Getting started with Constraints" => "tutorials/getting_started_with_constraints.md",
"Working with custom interpreters" => "tutorials/working_with_interpreters.md"
"Working with custom interpreters" => "tutorials/working_with_interpreters.md",
"Abstract Syntax Trees" => "tutorials/abstract_syntax_trees.md",
],
"Sub-Modules" => [
"HerbCore.jl" => "HerbCore/index.md",
Expand Down
6 changes: 3 additions & 3 deletions docs/src/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ using HerbGrammar, HerbSpecification, HerbSearch, HerbInterpret

To define a program synthesis problem, we need a grammar and specification.

First, a grammar can be constructed using the `@cfgrammar` macro included in `HerbGrammar`. Alternatively, we can use the `@csgrammar` macro, which will be shown later on in the tutorial when we use constraints.
First, a grammar can be constructed using the `@csgrammar` macro included in `HerbGrammar`.

Here, we describe a simple integer arithmetic example, that can add and multiply an input variable `x` or the integers `1,2`, using


```julia
g = @cfgrammar begin
g = @csgrammar begin
Number = |(1:2)
Number = x
Number = Number + Number
Expand Down Expand Up @@ -62,7 +62,7 @@ using HerbSearch, HerbSpecification, HerbInterpret, HerbGrammar

# define our very simple context-free grammar
# Can add and multiply an input variable x or the integers 1,2.
g = @cfgrammar begin
g = @csgrammar begin
Number = |(1:2)
Number = x
Number = Number + Number
Expand Down
18 changes: 18 additions & 0 deletions docs/src/tutorials/abstract_syntax_trees.html

Large diffs are not rendered by default.

Loading

0 comments on commit cf02c8e

Please sign in to comment.