NEPL3 実例

ドキュメント

repositoryの原文です。ここでは実行しません。実行には各言語の処理系と解決済みProfileが必要です。

doc.integration

Doc / Article

原文を取得

article ja "数式と回路"
body
  cons paragraph
    cons "これは{[数式/すうしき]/formula}の[例/れい]である。"
    cons sentence
      cons text "値を計算する前の式: "
      cons math Math add frac 1 2 frac 1 3
      nil
    nil
  cons display Math
    label frac 5 6 Doc "[厳密値/げんみつち]"
  cons circuit "半加算器"
    Circuit
      design
        cons module HalfAdder
          cons input a 1 cons input b 1 nil
          nil
          cons output sum 1 xor a b
          cons output carry 1 and a b
          nil
        nil
        HalfAdder
        nil
  cons code Math frac 1 0
  nil

doc.line-break

Doc / Article

原文を取得

article ja "[明示的/めいじてき]な[改行/かいぎょう]"
body
  cons paragraph
    cons parallel
      cons variant ja sentence
        cons text "ここで"
        cons break
        cons ruby text "改行" text "かいぎょう"
        cons text "します。"
        nil
      cons variant en sentence
        cons text "This sentence continues"
        cons break
        cons text "on the next line."
        nil
      nil
    nil
  nil

doc.linear-combination

Doc / Article

原文を取得

article ja sentence
  cons anno text "ベクトル" cons text "vector" nil
  cons text "の"
  cons anno ruby text "線型結合" text "せんけいけつごう" cons text "linear combination" nil
  cons text "と"
  cons anno text "スパン" cons text "span" nil
  nil
body
  cons section linear_combination sentence
    cons anno ruby text "線型結合" text "せんけいけつごう" cons text "linear combination" nil
    nil
    body
      cons paragraph
        cons parallel
          cons variant ja "いくつかの{ベクトル/vector}をそれぞれ{[定数倍/ていすうばい]/scalar multiplication}して[足/た]し[合/あ]わせることを、{[線型結合/せんけいけつごう]/linear combination}といいます。"
          cons variant en "A linear combination is formed by multiplying each of several vectors by a scalar and adding the results."
          nil
        cons parallel
          cons variant ja sentence
            cons text "それぞれの"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "に"
            cons ruby text "掛" text "か"
            cons text "ける"
            cons ruby text "数" text "かず"
            cons text "が、"
            cons anno ruby text "係数" text "けいすう" cons text "coefficient" nil
            cons text "です。"
            nil
          cons variant en sentence
            cons text "The number multiplying each vector is called its coefficient."
            nil
          nil
        nil
    nil
  cons section span sentence
    cons anno text "スパン" cons text "span" nil
    nil
    body
      cons paragraph
        cons parallel
          cons variant ja sentence
            cons anno ruby text "係数" text "けいすう" cons text "coefficient" nil
            cons text "を"
            cons ruby text "自由" text "じゆう"
            cons text "に"
            cons ruby text "変" text "か"
            cons text "えて、"
            cons ref linear_combination anno ruby text "線型結合" text "せんけいけつごう" cons text "linear combination" nil
            cons text "で"
            cons ruby text "作" text "つく"
            cons text "れる"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "を"
            cons strong text "すべて"
            cons ruby text "集" text "あつ"
            cons text "めたものが、"
            cons ruby text "元" text "もと"
            cons text "の"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "たちの"
            cons anno text "スパン" cons text "span" nil
            cons text "です。"
            nil
          cons variant en sentence
            cons text "The span of a collection of vectors is the set of "
            cons strong text "all vectors"
            cons text " that can be formed as "
            cons ref linear_combination text "linear combinations"
            cons text " of them, allowing the coefficients to vary freely."
            nil
          nil
        cons parallel
          cons variant ja sentence
            cons anno ruby text "係数" text "けいすう" cons text "coefficient" nil
            cons text "を"
            cons ruby text "一組" text "ひとくみ"
            cons text "だけ"
            cons ruby text "決" text "き"
            cons text "めて"
            cons ruby text "得" text "え"
            cons text "られる"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "と、そのすべての"
            cons ruby text "可能性" text "かのうせい"
            cons text "を"
            cons ruby text "集" text "あつ"
            cons text "めた"
            cons anno text "スパン" cons text "span" nil
            cons text "を"
            cons ruby text "区別" text "くべつ"
            cons text "しましょう。"
            nil
          cons variant en sentence
            cons text "Distinguish a single vector obtained from one choice of coefficients from the span, which contains all possible results."
            nil
          nil
        nil
    nil
  cons section plane sentence
    cons anno concat
      cons ruby text "平面" text "へいめん"
      cons text "での"
      cons ruby text "例" text "れい"
      nil
      cons text "examples in the plane" nil
    nil
    body
      cons paragraph
        cons parallel
          cons variant ja sentence
            cons text "たとえば"
            cons anno ruby text "平面" text "へいめん" cons text "plane" nil
            cons text "では、0でない"
            cons ruby text "一本" text "いっぽん"
            cons text "の"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "の"
            cons anno text "スパン" cons text "span" nil
            cons text "は、"
            cons anno ruby text "原点" text "げんてん" cons text "origin" nil
            cons text "を"
            cons ruby text "通" text "とお"
            cons text "る"
            cons ruby text "一本" text "いっぽん"
            cons text "の"
            cons anno ruby text "直線" text "ちょくせん" cons text "line" nil
            cons text "です。"
            nil
          cons variant en sentence
            cons text "For example, in the plane, the span of one nonzero vector is a line through the origin."
            nil
          nil
        cons parallel
          cons variant ja sentence
            cons ruby text "同" text "おな"
            cons text "じ"
            cons ruby text "方向" text "ほうこう"
            cons text "や"
            cons ruby text "逆方向" text "ぎゃくほうこう"
            cons text "の"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "を"
            cons ruby text "何本" text "なんぼん"
            cons ruby text "加" text "くわ"
            cons text "えても、この"
            cons anno text "スパン" cons text "span" nil
            cons text "は"
            cons ruby text "変" text "か"
            cons text "わりません。"
            nil
          cons variant en sentence
            cons text "Adding any number of vectors in the same or opposite direction leaves this span unchanged."
            nil
          nil
        cons parallel
          cons variant ja sentence
            cons anno ruby text "平行" text "へいこう" cons text "parallel" nil
            cons text "でない"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "を"
            cons ruby text "加" text "くわ"
            cons text "えると、"
            cons anno text "スパン" cons text "span" nil
            cons text "は"
            cons anno ruby text "平面" text "へいめん" cons text "plane" nil
            cons ruby text "全体" text "ぜんたい"
            cons text "になります。"
            nil
          cons variant en sentence
            cons text "Adding a vector that is not parallel to that line makes the span the entire plane."
            nil
          nil
        nil
      cons table cons left cons left cons right nil
        some row
          cons sentence
            cons anno concat
              cons ruby text "平面内" text "へいめんない"
              cons text "のベクトル"
              nil
              cons text "vectors in the plane" nil
            nil
          cons sentence
            cons anno text "スパン" cons text "span" nil
            nil
          cons sentence
            cons anno ruby text "次元" text "じげん" cons text "dimension" nil
            nil
          nil
        cons row
          cons sentence
            cons anno concat
              cons text "0でない"
              cons ruby text "一本" text "いっぽん"
              nil
              cons text "one nonzero vector" nil
            nil
          cons sentence
            cons anno concat
              cons ruby text "原点" text "げんてん"
              cons text "を"
              cons ruby text "通" text "とお"
              cons text "る"
              cons ruby text "直線" text "ちょくせん"
              nil
              cons text "a line through the origin" nil
            nil
          cons sentence cons text "1" nil
          nil
        cons row
          cons sentence
            cons anno concat
              cons ruby text "平行" text "へいこう"
              cons text "な"
              cons ruby text "二本" text "にほん"
              cons text "("
              cons ruby text "少" text "すく"
              cons text "なくとも"
              cons ruby text "一本" text "いっぽん"
              cons text "は0でない)"
              nil
              cons text "two parallel vectors, at least one nonzero" nil
            nil
          cons sentence
            cons anno concat
              cons ruby text "原点" text "げんてん"
              cons text "を"
              cons ruby text "通" text "とお"
              cons text "る"
              cons ruby text "直線" text "ちょくせん"
              nil
              cons text "a line through the origin" nil
            nil
          cons sentence cons text "1" nil
          nil
        cons row
          cons sentence
            cons anno concat
              cons ruby text "平行" text "へいこう"
              cons text "でない"
              cons ruby text "二本" text "にほん"
              nil
              cons text "two nonparallel vectors" nil
            nil
          cons sentence
            cons anno ruby text "平面全体" text "へいめんぜんたい" cons text "the entire plane" nil
            nil
          cons sentence cons text "2" nil
          nil
        nil
    nil
  cons section independence sentence
    cons anno concat
      cons ruby text "一次独立" text "いちじどくりつ"
      cons text "と"
      cons ruby text "次元" text "じげん"
      nil
      cons text "linear independence and dimension" nil
    nil
    body
      cons paragraph
        cons parallel
          cons variant ja sentence
            cons text "このように、"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "の"
            cons ruby text "本数" text "ほんすう"
            cons text "が"
            cons ruby text "増" text "ふ"
            cons text "えても、"
            cons anno text "スパン" cons text "span" nil
            cons text "の"
            cons anno ruby text "次元" text "じげん" cons text "dimension" nil
            cons text "が"
            cons ruby text "増" text "ふ"
            cons text "えるとは"
            cons ruby text "限" text "かぎ"
            cons text "りません。"
            nil
          cons variant en sentence
            cons text "Increasing the number of vectors does not necessarily increase the dimension of their span."
            nil
          nil
        cons parallel
          cons variant ja sentence
            cons anno text "スパン" cons text "span" nil
            cons text "の"
            cons anno ruby text "次元" text "じげん" cons text "dimension" nil
            cons text "は、"
            cons ruby text "元" text "もと"
            cons text "の"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "たちから"
            cons ruby text "選" text "えら"
            cons text "べる"
            cons anno ruby text "一次独立" text "いちじどくりつ" cons text "linearly independent" nil
            cons text "な"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "の"
            cons ruby text "最大本数" text "さいだいほんすう"
            cons text "で"
            cons ruby text "決" text "き"
            cons text "まります。"
            nil
          cons variant en sentence
            cons text "The dimension of the span is the largest number of linearly independent vectors that can be selected from the original collection."
            nil
          nil
        cons parallel
          cons variant ja sentence
            cons anno ruby text "一次独立" text "いちじどくりつ" cons text "linearly independent" nil
            cons text "とは、"
            cons ruby text "選" text "えら"
            cons text "んだどの"
            cons ruby text "一本" text "いっぽん"
            cons text "も、"
            cons ruby text "残" text "のこ"
            cons text "りの"
            cons anno text "ベクトル" cons text "vector" nil
            cons text "の"
            cons anno ruby text "線型結合" text "せんけいけつごう" cons text "linear combination" nil
            cons text "では"
            cons ruby text "作" text "つく"
            cons text "れないということです。"
            nil
          cons variant en sentence
            cons text "The selected vectors are linearly independent if none of them can be formed as a linear combination of the others."
            nil
          nil
        nil
    nil
  nil

doc.parallel

Doc / Article

原文を取得

article ja "文単位の対応"
body
  cons paragraph
    cons parallel
      cons variant ja "これは[文/ぶん]である。"
      cons variant en "This is a sentence."
      nil
    cons paragraph
      cons parallel
        cons variant ja "ここは[内側/うちがわ]の[段落/だんらく]である。"
        cons variant en "This is a nested paragraph."
        nil
      nil
    cons parallel
      cons variant ja "[外側/そとがわ]に[戻/もど]った。"
      cons variant en "We are back in the outer paragraph."
      nil
    nil
  nil

doc.prefix

Doc / Article

原文を取得

article ja "注釈の例"
body
  cons paragraph
    cons sentence
      cons text "これは"
      cons ruby text "文書" text "ぶんしょ"
      cons text "を"
      cons ruby text "記述" text "きじゅつ"
      cons text "するための"
      cons anno text "DSL" cons text "Domain Specific Language" nil
      nil
    nil
  nil

doc.references

Doc / Article

原文を取得

article ja "参照"
body
  cons paragraph
    cons sentence
      cons ref introduction text "はじめに"
      cons text "を参照する。"
      nil
    nil
  cons section introduction "はじめに"
    body
      cons paragraph
        cons "ここが[定義/ていぎ][箇所/かしょ]である。"
        nil
      nil
  nil

doc.sentence

Doc / Article

原文を取得

article ja "注釈の例"
body
  cons paragraph
    cons "これは[文書/ぶんしょ]を[記述/きじゅつ]するための{DSL/Domain Specific Language}"
    nil
  nil

grammar.angle-tag

Grammar / Root

原文を取得

language Angle 1 Tag
  cons category Tag Tags
  cons reader tag
    seq
      cons literal "<"
      cons commit
        seq
          cons some scalar asciiLetter
          cons many
            choice
              cons discard seq
                cons literal "\""
                cons many scalar except "\""
                cons literal "\""
                nil
              cons discard seq
                cons literal "'"
                cons many scalar except "'"
                cons literal "'"
                nil
              cons discard scalar except "\"'><"
              nil
          cons literal ">"
          nil
      nil
  cons mode Tags cons take AngleTag tag nil
  cons leaf AngleTag Tag AngleTag none cons style self "content" nil
  nil

grammar.binding

Grammar / Root

原文を取得

language BindDemo 1 Expr
  cons category Expr Code
  cons namespace Value lexical
  cons reader ws some scalar whitespace
  cons extension BuiltinWord "nepl3.reader/name-v1" "reader/v1"
  cons reader word call "nepl3.reader/name-v1"
  cons reader number some scalar digit
  cons mode Code
    cons skip ws
    cons take Word word
    cons take Number number
    nil
  cons leaf Number Expr Number none cons style self "quantity" nil
  cons leaf Name Expr Word
    reference Value self
    cons style self "name" nil
  cons form Let Expr "let"
    cons field name builtin Name
    cons field init local Expr
    cons field body local Expr
    nil
    group
      cons visit init
      cons scope
        cons bind Value name
        cons visit body
        nil
      nil
    cons style head "marker" nil
  cons form Lambda Expr "lambda"
    cons field parameter builtin Name
    cons field body local Expr
    nil
    scope
      cons bind Value parameter
      cons visit body
      nil
    cons style head "marker" nil
  cons form Apply Expr "apply"
    cons field function local Expr
    cons field argument local Expr
    nil
    group cons visit function cons visit argument nil
    cons style head "marker" nil
  nil

grammar.provider

Grammar / Root

原文を取得

language SentenceOnly 1 Sentence
  cons category Sentence Sentences
  cons extension Reader "doc.reader/sentence-v1" "reader/v1"
  cons reader sentence call "doc.reader/sentence-v1"
  cons mode Sentences cons take SentenceLiteral sentence nil
  cons leaf SentenceLiteral Sentence SentenceLiteral none
    cons style self "content" nil
  nil

math.binding

Math / Expr

原文を取得

let x 10
  let x add x 1
    x

math.decimal

Math / Expr

原文を取得

add 0.1 0.2

math.doc-label

Math / Expr

原文を取得

label sqrt 2 Doc "[平方根/へいほうこん]"

math.matrix

Math / Expr

原文を取得

det
  matrix
    cons row cons 1 cons 2 nil
    cons row cons 3 cons 4 nil
    nil

math.notation

Math / Expr

原文を取得

equal
  integral x 0 1 pow x 2
  frac 1 3

math.rational

Math / Expr

原文を取得

add frac 1 2 frac 1 3

math.sum

Math / Expr

原文を取得

sum i 1 4 pow i 2

circuit.half-adder

Circuit / Design

原文を取得

design
  cons module HalfAdder
    cons input a 1 cons input b 1 nil
    nil
    cons output sum 1 xor a b
    cons output carry 1 and a b
    nil
  nil
  HalfAdder
  cons test all_inputs HalfAdder
    cons tick cons false cons false nil cons false cons false nil
    cons tick cons false cons true nil cons true cons false nil
    cons tick cons true cons false nil cons true cons false nil
    cons tick cons true cons true nil cons false cons true nil
    nil
  nil

circuit.instances

Circuit / Design

原文を取得

design
  cons module Register
    cons input d 1 nil
    cons state q 1 false
    cons next q d
    nil
    cons output value 1 q nil
  cons module Independent
    cons input a 1 cons input b 1 nil
    cons inst left Register cons a nil
    cons inst right Register cons b nil
    nil
    cons output first 1 at left value
    cons output second 1 at right value
    nil
  nil
  Independent
  cons test independent Independent
    cons tick cons true cons false nil cons false cons false nil
    cons tick cons false cons true nil cons true cons false nil
    cons tick cons false cons false nil cons false cons true nil
    nil
  nil

circuit.simultaneous

Circuit / Design

原文を取得

design
  cons module Swap
    nil
    cons state a 1 false
    cons state b 1 true
    cons next a b
    cons next b a
    nil
    cons output first 1 a cons output second 1 b nil
  nil
  Swap
  cons test simultaneous Swap
    cons tick nil cons false cons true nil
    cons tick nil cons true cons false nil
    cons tick nil cons false cons true nil
    nil
  nil

circuit.state-feedback

Circuit / Design

原文を取得

design
  cons module Register
    cons input d 1 nil
    cons state q 1 false
    cons next q d
    nil
    cons output value 1 q nil
  cons module Feedback
    nil
    cons inst reg Register cons not at reg value nil
    nil
    cons output value 1 at reg value nil
  nil
  Feedback
  cons test feedback Feedback
    cons tick nil cons false nil
    cons tick nil cons true nil
    cons tick nil cons false nil
    nil
  nil

circuit.toggle

Circuit / Design

原文を取得

design
  cons module Toggle
    cons input toggle 1 nil
    cons state q 1 false
    cons next q xor q toggle
    nil
    cons output value 1 q nil
  nil
  Toggle
  cons test sequence Toggle
    cons tick cons true nil cons false nil
    cons tick cons true nil cons true nil
    cons tick cons false nil cons false nil
    cons tick cons false nil cons false nil
    nil
  nil