Fri Apr 16 10:38:48 2021
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2016-03-01

LEARN

2021-04-16 | 2021-03-16 | 2021-02-16 | 2021-01-16 | 2020-12-16 | 2020-11-16 | 2020-10-16 | 2020-09-16 | 2020-08-16 | 2020-07-16 | 2020-06-16 | 2020-05-16 | 2020-04-16 | 2020-03-16 | 2020-02-16 | 2020-01-16 | 2019-12-16 | 2019-11-16 | 2019-10-16 | 2019-09-16 | 2019-08-16 | 2019-07-16 | 2019-06-16 | 2019-05-16 | 2019-04-16 | 2019-03-16 | 2019-02-16 | 2019-01-16 | 2018-12-16 | 2018-11-16 | 2018-10-16 | 2018-09-16 | 2018-08-16 | 2018-07-16 | 2018-06-16 | 2018-05-16 | 2018-04-16 | 2018-03-16 | 2018-02-16 | 2018-01-16 | 2017-12-16 | 2017-11-16 | 2017-10-16 | 2017-09-16 | 2017-08-16 | 2017-07-16 | 2017-06-16 | 2017-05-16 | 2017-04-16 | 2017-03-16 | 2017-02-16 | 2017-01-16 | 2016-12-16 | 2016-11-16 | 2016-10-16 | 2016-09-16 | 2016-08-16 | 2016-07-16 | 2016-06-16 | 2016-05-16 | 2016-04-16 | 2016-03-16 | 2016-02-16 | 2016-01-16 | 2015-12-16 | 2015-11-16 | 2015-10-16 | 2015-09-16 | 2015-08-16 | 2015-07-16 | 2015-06-16 | 2015-05-16 | 2015-04-16 | 2015-03-16 | 2015-02-16 | 2015-01-16 | 2014-12-16 | 2014-11-16 | 2014-10-16

Key: Value:

Key: Value:

MESSAGE
DATE 2016-03-14
FROM Christopher League
SUBJECT Re: [Learn] CTX object
From learn-bounces-at-nylxs.com Mon Mar 14 20:52:02 2016
Return-Path:
X-Original-To: archive-at-mrbrklyn.com
Delivered-To: archive-at-mrbrklyn.com
Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82])
by mrbrklyn.com (Postfix) with ESMTP id 61CB3163D4B;
Mon, 14 Mar 2016 20:52:02 -0400 (EDT)
X-Original-To: learn-at-nylxs.com
Delivered-To: learn-at-nylxs.com
Received: from B-EXH-EDGE1.liunet.edu (b-edge1.smtp.liu.edu [148.4.248.206])
by mrbrklyn.com (Postfix) with ESMTP id 9DCF4163D43;
Mon, 14 Mar 2016 19:39:57 -0400 (EDT)
Received: from B-EXH-3.liunet.edu (148.4.250.212) by B-EXH-EDGE1.liunet.edu
(148.4.248.206) with Microsoft SMTP Server (TLS) id 14.3.210.2; Mon, 14 Mar
2016 19:39:53 -0400
Received: from localhost (96.250.202.133) by B-EXH-3.liunet.edu
(148.4.250.212) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Mon, 14 Mar
2016 19:39:56 -0400
From: Christopher League
To: Ruben.Safir , ,

In-Reply-To: <56E74339.6080100-at-my.liu.edu>
Message-ID: <87wpp43a5q.fsf-at-lydrik.home.lan>
References: <56E74339.6080100-at-my.liu.edu>
User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1
(x86_64-unknown-linux-gnu)
Date: Mon, 14 Mar 2016 19:39:52 -0400
MIME-Version: 1.0
X-Originating-IP: [96.250.202.133]
X-ClientProxiedBy: U-EXH-CAS.liunet.edu (148.4.184.26) To B-EXH-3.liunet.edu
(148.4.250.212)
X-Mailman-Approved-At: Mon, 14 Mar 2016 20:51:46 -0400
Subject: Re: [Learn] CTX object
X-BeenThere: learn-at-nylxs.com
X-Mailman-Version: 2.1.17
Precedence: list
List-Id:
List-Unsubscribe: ,

List-Archive:
List-Post:
List-Help:
List-Subscribe: ,

Content-Type: multipart/mixed; boundary="===============1958295665=="
Errors-To: learn-bounces-at-nylxs.com
Sender: "Learn"

--===============1958295665==
Content-Type: multipart/signed; boundary="===-=-="; micalg=pgp-sha256;
protocol="application/pgp-signature"

--===-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="

--==-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


The parameter `ctx` (aka context) refers to a node in the parse tree. So
they are instantiated within the Parser class generated by ANTLR. As it
parses the input stream, it generates these nodes.

Because it's using a *heterogeneous* tree representation, it actually
can refer to a variety of different classes, in this case `ProgContext`
to represent programs (the `prog` non-terminal), `StmtContext` to
represent statements, and `ExprContext` for expressions. The exact set
of context classes will depend on your grammar and the use of the "hash
tags" described in "Distinguishing rule alternatives."


They are all subclasses of `ParserRuleContext` (in the ANTLR library),
which is in turn a subclass of `ParseTree`.

CL

"Ruben.Safir" writes:

> can anyone tell me where this ctx object is defined and when it is=20
> instantiated?
>
>
> visitProg(ctx) top-level program
> where ctx.stmt(0).getText() is "n=3D5"
> and ctx.stmt(1).getText() is "print -3*(n+1)"
> visitStmt(ctx) assignment statement
> where ctx.ID().getText() is "n"
> and ctx.expr().getText() is "5"
> visitExpr(ctx) numeric literal
> where ctx.NUM().getText() is "5"
> visitStmt(ctx) print statementan
> where ctx.ID() is null
> and ctx.expr().getText() is "-3*(n+1)"
> visitExpr(ctx) multiplication
> where ctx.expr(0).getText() is "-3"
> and ctx.expr(1).getText() is "(n+1)"
> visitExpr(ctx) negation
> where ctx.expr(0).getText() is "3"
> visitExpr(ctx) numeric literal
> where ctx.NUM().getText() is "3"
> visitExpr(ctx) parentheses
> where ctx.expr(0).getText() is "n+1"
> visitExpr(ctx) addition
> where ctx.expr(0).getText() is "n"
> and ctx.expr(1).getText() is "1"
> visitExpr(ctx) variable
> where ctx.ID().getText() is "n"
> visitExpr(ctx) numeric literal
> where ctx.NUM().getText() is "1"

--==-=-=
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable






1.0, user-scalable=3Dyes">




The parameter ctx (aka context) refers to a node in the par=
se tree. So they are instantiated within the Parser class generated by ANTL=
R. As it parses the input stream, it generates these nodes.


Because it=E2=80=99s using a heterogeneous tree representation,=
it actually can refer to a variety of different classes, in this case e>ProgContext to represent programs (the prog non-termi=
nal), StmtContext to represent statements, and ExprConte=
xt
for expressions. The exact set of context classes will depend on =
your grammar and the use of the =E2=80=9Chash tags=E2=80=9D described in =
=E2=80=9CDistinguishing rule alternatives.=E2=80=9D s.net/cs664s16/visitor.html#distinguishing-rule-alternatives" class=3D"uri"=
>https://liucs.net/cs664s16/visitor.html#distinguishing-rule-alternativesa>


They are all subclasses of ParserRuleContext (in the ANTLR =
library), which is in turn a subclass of ParseTree.


CL


=E2=80=9CRuben.Safir=E2=80=9D =
ruben.safir-at-my.liu.edu
writes:



can anyone tell me where this ctx object is defined and when it is insta=
ntiated?


 visitProg(ctx) top-level program
where ctx.stmt(0).getText() is "n=3D5"
and ctx.stmt(1).getText() is "print -3*(n+1)"
visitStmt(ctx) assignment statement
where ctx.ID().getText() is "n"
and ctx.expr().getText() is "5"
visitExpr(ctx) numeric literal
where ctx.NUM().getText() is "5"
visitStmt(ctx) print statementan
where ctx.ID() is null
and ctx.expr().getText() is "-3*(n+1)"
visitExpr(ctx) multiplication
where ctx.expr(0).getText() is "-3"
and ctx.expr(1).getText() is "(n+1)"
visitExpr(ctx) negation
where ctx.expr(0).getText() is "3"
visitExpr(ctx) numeric literal
where ctx.NUM().getText() is "3"
visitExpr(ctx) parentheses
where ctx.expr(0).getText() is "n+1"
visitExpr(ctx) addition
where ctx.expr(0).getText() is "n"
and ctx.expr(1).getText() is "1"
visitExpr(ctx) variable
where ctx.ID().getText() is "n"
visitExpr(ctx) numeric literal
where ctx.NUM().getText() is "1"





--==-=-=--

--=-=-=--

--===-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJW50vIAAoJEGuLsz1PMbCLX9EH/39nA9Mt4hKyyMr3/PB5i84e
er+i+nQ9PvFItrB+haMBigH956S3ah/sE0gyhErXWK3OMCctmigZWpdLQWxpfbYZ
E68cMb0tUXZIZXM4CKxQHqtZ5XL1vq/qOXoY3Z9Sd+lDYDbiwTZEdFbuVYXW89Yf
nymFGnoZ1z3kDGnTxvlZwKtMDC1Bd59O0XAbvO3K5a3mKntOvAieS02G10DXa8AN
9YpeDEZRWe33j4XXhFI4LoZX37KXgm6P8F4+67pOYh4oUHpNFvyz3WAzmpOSzbce
MISwvA4NCFuUiSZkKumQLXV2Rdshnw5PoT5h3q7fQ9Gor4Y/fc8fbwY85pmxhRQ=
=AITe
-----END PGP SIGNATURE-----
--===-=-=--

--===============1958295665==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Learn mailing list
Learn-at-nylxs.com
http://lists.mrbrklyn.com/mailman/listinfo/learn

--===============1958295665==--

  1. 2016-03-01 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [Learn] Announcement: Workshop Organizational Meeting tomorrow
  2. 2016-03-03 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [Learn] internships in IT
  3. 2016-03-04 Ruben Safir <ruben.safir-at-my.liu.edu> Subject: [Learn] Fwd: CSA Events Newsletter-Learning Beyond the Classroom
  4. 2016-03-05 Ruben Safir <mrbrklyn-at-panix.com> Subject: [Learn] [Hangout-NYLXS] Announcement: Workshop Organizational
  5. 2016-03-07 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [Learn] [Hangout-NYLXS] Announcement: Workshop Organizational
  6. 2016-03-14 Christopher League <Christopher.League-at-liu.edu> Re: [Learn] CTX object
  7. 2016-03-14 Ruben Safir <mrbrklyn-at-panix.com> Re: [Learn] [Hangout-NYLXS] NYLXS: Kernel and C Programming Workshop
  8. 2016-03-14 eminker-at-gmail.com Re: [Learn] [Hangout-NYLXS] NYLXS: Kernel and C Programming Workshop
  9. 2016-03-14 From: "Ruben.Safir" <ruben.safir-at-my.liu.edu> Subject: [Learn] CTX object
  10. 2016-03-14 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [Learn] NYLXS: Kernel and C Programming Workshop

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!