module Main exposing (main) import Browser import Html exposing (Html) import Html.Events exposing (onInput) import Bergamot.Syntax exposing (..) import Bergamot.Search exposing (..) import Bergamot.Rules exposing (..) import Bergamot.Parser exposing (..) import Maybe import Tuple import Debug type alias Model = { program : String } type alias Flags = () type Msg = SetProgram String init : Flags -> (Model, Cmd Msg) init () = ({ program = "" }, Cmd.none) view : Model -> Html Msg view m = Html.div [] [ Html.textarea [ onInput SetProgram ] [] , Html.p [] [ Html.text (Debug.toString (run program m.program)) ] ] update : Msg -> Model -> (Model, Cmd Msg) update msg m = case msg of SetProgram prog -> ({ m | program = prog }, Cmd.none) subscriptions : Model -> Sub Msg subscriptions _ = Sub.none main = Browser.element { init = init , view = view , update = update , subscriptions = subscriptions }