There are two kinds of errors that Basis can find.

  • Syntax errors occur during the parsing of input code, and are caused by grammatically incorrect statements.
    Typical errors might be an illegal character in the input, a missing operator, two operators in a row,
    two statements on the same line with no intervening semicolon, unbalanced parentheses, a misplaced reserved word, etc.

  •  Semantic errors occur during the execution of the code, after it has been parsed as grammatically correct.
    These have to do not with how statements are constructed, but with what they mean.
    Such things as incorrect variable types or sizes, nonexistent variables, subscripts out of range, and the like, are semantic errors.

Basis is a single-pass  parser, that is, it looks at its input only once.

It also is a one-look ahead  parser, meaning that at the most it is never looking more than one symbol ahead of the current context.

By the time a syntax error has been detected, it is likely that a lot of the context information to the left of the error has already been lost.

The diagnostic information that Basis gives attempts to be as useful as possible,

but because of the very limited context information available, it is far from perfect.

Semantic errors are often possible to diagnose more precisely.

We have attempted to make the semantic error information supplied as useful as possible.

Sometimes some of the information is only useful to someone familiar with the internals of Basis;

but we hope that in most cases it will help you find your error.

Syntax Error:

error due to missing colon, semicolon, parenthesis, etc.

Syntax is the way in which we construct sentences by following principles and rules.

Example: In C++, it would be a syntax error to say

int x = "five";

This will not compile because it does not follow the syntax of the language and does not make any sense to the compiler.

Semantic Error:

it is a logical error. it is due to wrong logical statements.

Semantics is the interpretations of and meanings derived from the sentence transmission and understanding of the message.

Semantics errors are Logical, while Syntax errors are code errors.

Example: A semantic error would compile, but be incorrect logically:

const int pi = 12345;

Your program will likely compile and run without error but your results will be incorrect.

(Note that these types of errors are usually much harder to debug)

Syntactic and Semantic Errors的更多相关文章

  1. Type Systems

    This section deals with more theoretical aspects of types. A type system is a set of rules used by a ...

  2. Understanding Tensorflow using Go

    原文: https://pgaleone.eu/tensorflow/go/2017/05/29/understanding-tensorflow-using-go/ Tensorflow is no ...

  3. 2016年最新mac下vscode配置golang开发环境支持debug

    网上目前还找不到完整的mac下golang环境配置支持,本人配置成功,现在整理分享出来. mac最好装下xcode,好像有依赖关系安装Homebrew打开终端窗口, 粘贴脚本执行/usr/bin/ru ...

  4. coffeescript 1.8.0 documents

    CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque ...

  5. 6.00.1x Introduction to computation

    6.00 Introduction to Computer Science                  and  Programming • Goal: –Become skillful at ...

  6. Word2vec教程

    Word2vec Tutorial RADIM ŘEHŮŘEK 2014-02-02GENSIM, PROGRAMMING157 COMMENTS I never got round to writi ...

  7. coursera课程Text Retrieval and Search Engines之Week 1 Overview

    Week 1 OverviewHelp Center Week 1 On this page: Instructional Activities Time Goals and Objectives K ...

  8. 【DeepLearning】一些资料

    记录下,有空研究. http://nlp.stanford.edu/projects/DeepLearningInNaturalLanguageProcessing.shtml http://nlp. ...

  9. Chapter 4 Syntax Analysis

    Chapter 4 Syntax Analysis This chapter is devoted to parsing methods that are typically used in comp ...

随机推荐

  1. expect 交互 telnet 交互

    telnet 交互 #!/bin/bash Ip="10.0.1.53" a="\{\'method\'\:\'doLogin\'\,\'params\'\:\{\'uN ...

  2. expect 交互 之双引号较长变量

    交互双引号较长变量  #!/bin/bash RemoteUser=xuesong12 Ip=192.168.1.2 RemotePasswd=xuesong Cmd="/bin/echo ...

  3. HDU 2049 不容易系列之(4)——考新郎 (错排+组合)

    题目链接. Problem Description 国庆期间,省城HZ刚刚举行了一场盛大的集体婚礼,为了使婚礼进行的丰富一些,司仪临时想出了有一个有意思的节目,叫做"考新郎",具体 ...

  4. tensorboard遇到的坑

    <ul><li>No graph definition files were found.</li></ul> <p>启动命令 tensor ...

  5. perl6 HTTP::UserAgent (2)

    http://www.cnblogs.com/perl6/p/6911166.html 之前这里有个小小例子, 这里只要是总结一下. HTTP::UserAgent包含了以下模块: --------- ...

  6. Linux Timer定时器【转】

    转自:https://www.jianshu.com/p/66b3c75cae81 timerfd为Linux为用户程序提供的定时器接口,该接口基于文件描述符,通过文件描述符的可读事件进行超时通知,且 ...

  7. 关于Spring 事务管理传播属性的配置及作用-嵌套事务

    先了解事务的7种传播属性: PROPAGATION_REQUIRED -- 支持当前事务,如果当前没有事务,就新建一个事务.这是最常见的选择. PROPAGATION_SUPPORTS -- 支持当前 ...

  8. 关于tp5 的验证码遇到的一些问题

    问题1: 网上大部分给的安装包是: composer require topthink/think-captcha 但是会提示你下载失败说要你回复*****的原始数据啥的 那可能是因为你的安装环境版本 ...

  9. HTTP2.0新特性

    参考:http://www.tuicool.com/articles/mq2qm26

  10. BI生态圈常用端口使用配置总结

    Hadoop集群的各部分一般都会使用到多个端口,有些是daemon之间进行交互之用,有些是用于RPC访问以及HTTP访问.而随着Hadoop周边组件的增多,完全记不住哪个端口对应哪个应用,特收集记录如 ...